diff --git a/src/Graph/CartesianGraphFactory.hpp b/src/Graph/CartesianGraphFactory.hpp
index d9638e0328b46b5dbdc41f3d36cb2feab107ea0e..9a99be273e5ee3dbeb489c83225e4f00f60be281 100755
--- a/src/Graph/CartesianGraphFactory.hpp
+++ b/src/Graph/CartesianGraphFactory.hpp
@@ -230,7 +230,7 @@ public:
  * \tparam Graph Graph
  * \tparam pos Array of properties
  */
-template<int i, typename p, typename Graph, int ... pos>
+template<unsigned int dim, int i, typename p, typename Graph, int ... pos>
 struct fill_prop_by_type
 {
 
@@ -242,7 +242,7 @@ struct fill_prop_by_type
 
 	enum
 	{
-		value = ((sizeof...(pos) != 0) * (std::is_array<pos_prop_type>::value + 1))
+		value = ((sizeof...(pos) != 0 && dim <= 3) * (std::is_array<pos_prop_type>::value + 1))
 	};
 
 };
@@ -254,8 +254,8 @@ struct fill_prop_by_type
  * \tparam Graph Graph
  * \tparam pos Array of properties
  */
-template<typename p, typename Graph, int ... pos>
-struct fill_prop_by_type<0, p, Graph, pos...>
+template<unsigned int dim, typename p, typename Graph, int ... pos>
+struct fill_prop_by_type<dim, 0, p, Graph, pos...>
 {
 	enum
 	{
@@ -286,7 +286,7 @@ public:
 	 * \return the constructed graph
 	 *
 	 */
-	static Graph construct(const size_t (& sz)[dim], Box<dim,T> dom, const size_t(& bc)[dim])
+	static Graph construct(const size_t (& sz)[dim], Box<dim,T> & dom, const size_t(& bc)[dim])
 	{
 		// Calculate the size of the hyper-cubes on each dimension
 		T szd[dim];
@@ -335,7 +335,7 @@ public:
 
 			// vertex spatial properties functor
 
-			fill_prop<dim, lin_id, T, decltype(gp.vertex(g.LinId(key))), typename to_boost_vmpl<pos...>::type, fill_prop_by_type<sizeof...(pos), p, Graph, pos...>::value> flp(obj, szd, key, g, dom);
+			fill_prop<dim, lin_id, T, decltype(gp.vertex(g.LinId(key))), typename to_boost_vmpl<pos...>::type, fill_prop_by_type<dim,sizeof...(pos), p, Graph, pos...>::value> flp(obj, szd, key, g, dom);
 
 			// fill properties
 
@@ -407,7 +407,7 @@ public:
 	 * \return the constructed graph
 	 *
 	 */
-	static Graph construct(const size_t ( & sz)[dim], Box<dim,T> dom, const size_t(& bc)[dim])
+	static Graph construct(const size_t ( & sz)[dim], Box<dim,T> & dom, const size_t(& bc)[dim])
 	{
 		// Calculate the size of the hyper-cubes on each dimension
 
@@ -456,7 +456,7 @@ public:
 
 			// vertex spatial properties functor
 
-			fill_prop<dim, lin_id, T, decltype(gp.vertex(g.LinId(key))), typename to_boost_vmpl<pos...>::type, fill_prop_by_type<sizeof...(pos), p, Graph, pos...>::value> flp(obj, szd, key, g, dom);
+			fill_prop<dim, lin_id, T, decltype(gp.vertex(g.LinId(key))), typename to_boost_vmpl<pos...>::type, fill_prop_by_type<dim,sizeof...(pos), p, Graph, pos...>::value> flp(obj, szd, key, g, dom);
 
 			// fill properties
 
@@ -537,7 +537,7 @@ public:
 	 *
 	 */
 	template<int se, int id_prp, typename T, unsigned int dim_c, int ... pos>
-	static Graph construct(const size_t (&sz)[dim], Box<dim, T> dom, const size_t (& bc)[dim])
+	static Graph construct(const size_t (&sz)[dim], Box<dim, T> & dom, const size_t (& bc)[dim])
 	{
 		return Graph_constructor_impl<dim, id_prp, Graph, se, T, dim_c, pos...>::construct(sz, dom, bc);
 	}
diff --git a/src/Grid/grid_sm.hpp b/src/Grid/grid_sm.hpp
index 1530bf9d092b1a2b8b96646cb3fc7e98120dd399..25a1402831cbf3a2f1fc3ccc228bccc565140471 100755
--- a/src/Grid/grid_sm.hpp
+++ b/src/Grid/grid_sm.hpp
@@ -463,7 +463,7 @@ public:
 		mem_id lid = gk.get(0);
 		for (mem_id i = 1 ; i < N ; i++)
 		{
-			/* coverity[dead_error_begin */
+			/* coverity[dead_error_line] */
 			lid += gk.get(i) * sz_s[i-1];
 		}
 
diff --git a/src/NN/CellList/CellDecomposer.hpp b/src/NN/CellList/CellDecomposer.hpp
index bc1cf4ca0de41547f4c30ff3de9b2f4d82598396..692f268f26454c4117632a80d837bbf29e1a780f 100644
--- a/src/NN/CellList/CellDecomposer.hpp
+++ b/src/NN/CellList/CellDecomposer.hpp
@@ -1487,6 +1487,10 @@ public:
 	CellDecomposer_sm(const SpaceBox<dim,T> & box, const size_t (&div)[dim], Matrix<dim,T> & mat, const size_t pad)
 	:t(Matrix<dim,T>::identity(),box.getP1()),box(box),gr_cell()
 	{
+		// set div_wp to zero
+		for (size_t i = 0 ; i < dim ; i++)
+		{div_wp[i] = 0;}
+
 		Initialize(pad);
 	}
 
diff --git a/src/NN/CellList/CellList.hpp b/src/NN/CellList/CellList.hpp
index 69a04da5a92943fb6cd3906fc38fbd02a74ec8c4..93d2d66c91ed50b84e47514a4de98f0923a2c2ee 100644
--- a/src/NN/CellList/CellList.hpp
+++ b/src/NN/CellList/CellList.hpp
@@ -426,7 +426,7 @@ public:
 	//! Type of internal memory structure
 	typedef Mem_type Mem_type_type;
 
-	typedef CellNNIteratorSym<dim,CellList<dim,T,Mem_type,transform,vector_pos_type>,RUNTIME,vector_pos_type,NO_CHECK> SymNNIterator;
+	typedef CellNNIteratorSym<dim,CellList<dim,T,Mem_type,transform,vector_pos_type>,vector_pos_type,RUNTIME,NO_CHECK> SymNNIterator;
 
 	//! Object type that the structure store
 	typedef typename Mem_type::local_index_type value_type;
@@ -1004,7 +1004,7 @@ public:
 	 *
 	 */
 	template<unsigned int impl>
-	inline CellNNIteratorSym<dim,CellList<dim,T,Mem_type,transform,vector_pos_type>,(unsigned int)SYM,vector_pos_type,impl>
+	inline CellNNIteratorSym<dim,CellList<dim,T,Mem_type,transform,vector_pos_type>,vector_pos_type,(unsigned int)SYM,impl>
 	getNNIteratorSym(size_t cell, size_t p, const vector_pos_type & v)
 	{
 #ifdef SE_CLASS1
@@ -1012,7 +1012,7 @@ public:
 		{std::cerr << __FILE__ << ":" << __LINE__ << " Warning when you try to get a symmetric neighborhood iterator, you must construct the Cell-list in a symmetric way" << std::endl;}
 #endif
 
-		CellNNIteratorSym<dim,CellList<dim,T,Mem_type,transform,vector_pos_type>,SYM,vector_pos_type,impl> cln(cell,p,NNc_sym,*this,v);
+		CellNNIteratorSym<dim,CellList<dim,T,Mem_type,transform,vector_pos_type>,vector_pos_type,SYM,impl> cln(cell,p,NNc_sym,*this,v);
 		return cln;
 	}
 
@@ -1039,15 +1039,15 @@ public:
 	 *
 	 */
 	template<unsigned int impl>
-	inline CellNNIteratorSymMP<dim,CellList<dim,T,Mem_type,transform>,(unsigned int)SYM,impl>
-	getNNIteratorSymMP(size_t cell, size_t p, const openfpm::vector<Point<dim,T>> & v_p1, const openfpm::vector<Point<dim,T>> & v_p2)
+	inline CellNNIteratorSymMP<dim,CellList<dim,T,Mem_type,transform,vector_pos_type>,vector_pos_type,(unsigned int)SYM,impl>
+	getNNIteratorSymMP(size_t cell, size_t p, const vector_pos_type & v_p1, const vector_pos_type & v_p2)
 	{
 #ifdef SE_CLASS1
 		if (from_cd == false)
 			std::cerr << __FILE__ << ":" << __LINE__ << " Warning when you try to get a symmetric neighborhood iterator, you must construct the Cell-list in a symmetric way" << std::endl;
 #endif
 
-		CellNNIteratorSymMP<dim,CellList<dim,T,Mem_type,transform>,SYM,impl> cln(cell,p,NNc_sym,*this,v_p1,v_p2);
+		CellNNIteratorSymMP<dim,CellList<dim,T,Mem_type,transform,vector_pos_type>,vector_pos_type,SYM,impl> cln(cell,p,NNc_sym,*this,v_p1,v_p2);
 		return cln;
 	}
 
diff --git a/src/NN/CellList/CellNNIterator.hpp b/src/NN/CellList/CellNNIterator.hpp
index c146ed5426a4ae5707c43bd468ffb312b18c8ef3..ad4a50fb4b6a99e396d03e30978d858ca9f3d537 100644
--- a/src/NN/CellList/CellNNIterator.hpp
+++ b/src/NN/CellList/CellNNIterator.hpp
@@ -163,7 +163,7 @@ public:
  * \tparam impl implementation specific options NO_CHECK do not do check on access, SAFE do check on access
  *
  */
-template<unsigned int dim, typename Cell,int NNc_size, typename vector_pos_type, unsigned int impl>
+template<unsigned int dim, typename Cell, typename vector_pos_type,int NNc_size, unsigned int impl>
 class CellNNIteratorSym : public CellNNIterator<dim,Cell,NNc_size,impl>
 {
 	//! index of the particle p
@@ -226,7 +226,7 @@ public:
 	 * \return itself
 	 *
 	 */
-	inline CellNNIteratorSym<dim,Cell,NNc_size,vector_pos_type,impl> & operator++()
+	inline CellNNIteratorSym<dim,Cell,vector_pos_type,NNc_size,impl> & operator++()
 	{
 		this->start_id++;
 
@@ -252,16 +252,17 @@ public:
  * \tparam impl implementation specific options NO_CHECK do not do check on access, SAFE do check on access
  *
  */
-template<unsigned int dim, typename Cell,int NNc_size, unsigned int impl> class CellNNIteratorSymMP : public CellNNIterator<dim,Cell,NNc_size,impl>
+template<unsigned int dim, typename Cell, typename vector_pos_type , int NNc_size, unsigned int impl>
+class CellNNIteratorSymMP : public CellNNIterator<dim,Cell,NNc_size,impl>
 {
 	//! index of the particle p
 	size_t p;
 
 	//! Phase vector for particle p
-	const openfpm::vector<Point<dim,typename Cell::stype>> & v_p1;
+	const vector_pos_type & v_p1;
 
 	//! Phase vector for particle q
-	const openfpm::vector<Point<dim,typename Cell::stype>> & v_p2;
+	const vector_pos_type & v_p2;
 
 	/*! Select the next valid element
 	 *
@@ -309,8 +310,8 @@ public:
 			                   size_t p,
 							   const NNc_array<dim,NNc_size> &NNc,
 							   Cell & cl,
-							   const openfpm::vector<Point<dim,typename Cell::stype>> & v_p1,
-							   const openfpm::vector<Point<dim,typename Cell::stype>> & v_p2)
+							   const vector_pos_type & v_p1,
+							   const vector_pos_type & v_p2)
 	:CellNNIterator<dim,Cell,NNc_size,impl>(cell,NNc,cl),p(p),v_p1(v_p1),v_p2(v_p2)
 	{
 		selectValid();
@@ -322,7 +323,7 @@ public:
 	 * \return itself
 	 *
 	 */
-	inline CellNNIteratorSymMP<dim,Cell,NNc_size,impl> & operator++()
+	inline CellNNIteratorSymMP<dim,Cell,vector_pos_type,NNc_size,impl> & operator++()
 	{
 		this->start_id++;
 
diff --git a/src/NN/CellList/CellNNIteratorRuntime.hpp b/src/NN/CellList/CellNNIteratorRuntime.hpp
index e212c120d623518ce5a6157c3de761ac68413f88..3ded1d21240e00a7eec938350f7748e6c935dfc1 100644
--- a/src/NN/CellList/CellNNIteratorRuntime.hpp
+++ b/src/NN/CellList/CellNNIteratorRuntime.hpp
@@ -158,7 +158,7 @@ public:
  *
  */
 template<unsigned int dim, typename Cell,typename vector_pos_type, unsigned int impl>
-class CellNNIteratorSym<dim,Cell,RUNTIME,vector_pos_type,impl> : public CellNNIterator<dim,Cell,RUNTIME,impl>
+class CellNNIteratorSym<dim,Cell,vector_pos_type,RUNTIME,impl> : public CellNNIterator<dim,Cell,RUNTIME,impl>
 {
 	//! index of the particle p
 	size_t p;
@@ -228,7 +228,7 @@ public:
 	 * \return itself
 	 *
 	 */
-	inline CellNNIteratorSym<dim,Cell,RUNTIME,vector_pos_type,impl> & operator++()
+	inline CellNNIteratorSym<dim,Cell,vector_pos_type,RUNTIME,impl> & operator++()
 	{
 		this->start_id++;
 
diff --git a/src/NN/CellList/cuda/Cuda_cell_list_util_func.hpp b/src/NN/CellList/cuda/Cuda_cell_list_util_func.hpp
index 31dd0d4141d458229b1f15b826521209743cf12e..955e837f82f408e151274da1473807071146908f 100644
--- a/src/NN/CellList/cuda/Cuda_cell_list_util_func.hpp
+++ b/src/NN/CellList/cuda/Cuda_cell_list_util_func.hpp
@@ -80,7 +80,7 @@ struct cid_<2,cnt_type,ids_type,transform>
 		return e[0] + div_c[0] * e[1];
 	}
 
-	static inline __device__ __host__ cnt_type get_cid(const openfpm::array<ids_type,2,cnt_type> & div_c, const grid_key_dx<2,cnt_type> & e)
+	static inline __device__ __host__ cnt_type get_cid(const openfpm::array<ids_type,2,cnt_type> & div_c, const grid_key_dx<2,ids_type> & e)
 	{
 		return e.get(0) + div_c[0] * e.get(1);
 	}
diff --git a/src/NN/VerletList/VerletListFast.hpp b/src/NN/VerletList/VerletListFast.hpp
index 540a3b06fa459989edeeb3b93d0a62935f676e24..3294d2e0b5b2bb079a89e3889db6f896cdf3e90c 100644
--- a/src/NN/VerletList/VerletListFast.hpp
+++ b/src/NN/VerletList/VerletListFast.hpp
@@ -345,7 +345,7 @@ private:
 	{
 		if (opt == VL_CRS_SYMMETRIC)
 		{
-			create_<CellNNIteratorSym<dim,CellListImpl,RUNTIME,vector_pos_type,NO_CHECK>,VL_CRS_SYMMETRIC>(pos,pos2,dom,anom,r_cut,g_m,cl,opt);
+			create_<CellNNIteratorSym<dim,CellListImpl,vector_pos_type,RUNTIME,NO_CHECK>,VL_CRS_SYMMETRIC>(pos,pos2,dom,anom,r_cut,g_m,cl,opt);
 		}
 		else if (opt == VL_SYMMETRIC)
 		{
diff --git a/src/Space/Shape/HyperCube.hpp b/src/Space/Shape/HyperCube.hpp
index 18b4baa0b76b1bf008cd88c20129249de01e5074..2b3fb9b4525ca1b2b6fdfea27f94e94879cce972 100644
--- a/src/Space/Shape/HyperCube.hpp
+++ b/src/Space/Shape/HyperCube.hpp
@@ -402,7 +402,10 @@ public:
 				val = pos_n_zero[i] - pos_n_zero[i+1] - 1;
 			}
 			else
+			{
+				/* coverty[uninit_use] */
 				val = pos_n_zero[i];
+			}
 
 			for (long int j = 0 ; j < (long int)val; j++)
 			{
diff --git a/src/Space/Shape/Point.hpp b/src/Space/Shape/Point.hpp
index 6cd9aeae2ea5e71df0013f25fb13eac30ab48f18..7d76af7ed78dbab92c039227cfa056fcd170e3fc 100644
--- a/src/Space/Shape/Point.hpp
+++ b/src/Space/Shape/Point.hpp
@@ -395,6 +395,7 @@ template<unsigned int dim ,typename T> class Point
 
 		for (size_t i = 0 ; i < dim - 1 ; i++)
 		{
+			/* coverty[dead_error_line] */
 			str += std::to_string(static_cast<double>(get(i))) + " ";
 		}
 		str += std::to_string(static_cast<double>(get(dim-1)));
diff --git a/src/util/compute_optimal_device_grid.hpp b/src/util/compute_optimal_device_grid.hpp
index 96cfa2fddfbd2d176b08231dfac9f7c557988d43..05b9ec2f54b236c43b19107437f391a16a780f96 100644
--- a/src/util/compute_optimal_device_grid.hpp
+++ b/src/util/compute_optimal_device_grid.hpp
@@ -166,6 +166,7 @@ void calculate_optimal_device_grid(device_grid<dim> & dg,
 			{dg.grids.z *= z[jz];}
 
 			for (size_t k = 3 ; k < dim ; k++)
+			/* coverty[dead_error_line] */
 			{dg.grids.z *= sz[k];}
 
 			return;
@@ -227,6 +228,7 @@ void calculate_optimal_device_grid(device_grid<dim> & dg,
 			dg.threads.y *= best_fact;
 			dg.grids.y /= best_fact;
 		}
+		/* coverty[dead_error_line] */
 		else if (k_best == 2)
 		{
 			dg.threads.z *= best_fact;