diff --git a/src/Grid/grid_key.hpp b/src/Grid/grid_key.hpp
index f7de564ef7412b7511589a7785086e1761ef1125..2fa4573e9cf68b056eac5fb99dfa5a93e9e720b4 100644
--- a/src/Grid/grid_key.hpp
+++ b/src/Grid/grid_key.hpp
@@ -301,7 +301,8 @@ public:
 	 * \param t list of number
 	 *
 	 */
-	template<typename a, typename ...T>void set(a v, T...t)
+	template<typename a, typename ...T>
+	inline void set(a v, T...t)
 	{
 #ifdef SE_CLASS1
 		if (sizeof...(t) != dim -1)
@@ -311,6 +312,16 @@ public:
 		invert_assign(t...);
 	}
 
+	/*! \brief Return the internal k structure
+	 *
+	 * \return k
+	 *
+	 */
+	const long int(& get_k() const)[dim]
+	{
+		return k;
+	}
+
 	/*! \brief Convert to a point the grid_key_dx
 	 *
 	 * \see toPoint
@@ -367,7 +378,7 @@ public:
 	 * \return the index value
 	 *
 	 */
-	mem_id value(size_t i) const
+	inline mem_id value(size_t i) const
 	{
 		return k[i];
 	}
@@ -380,7 +391,7 @@ public:
 	 * \return the index value
 	 *
 	 */
-	mem_id get(size_t i) const
+	inline mem_id get(size_t i) const
 	{
 		return k[i];
 	}
@@ -393,7 +404,7 @@ public:
 	 * \param id value to set
 	 *
 	 */
-	void set_d(size_t i, mem_id id)
+	inline void set_d(size_t i, mem_id id)
 	{
 #ifdef SE_CLASS1
 
@@ -404,11 +415,11 @@ public:
 		k[i] = id;
 	}
 
+private:
+
 	//! structure that store all the index
 	mem_id k[dim];
 
-private:
-
 	/*! \brief Recursively invert the assignment
 	 *
 	 * Recursively invert the assignment at compile-time (hopefully)
diff --git a/src/Grid/grid_sm.hpp b/src/Grid/grid_sm.hpp
index 8dd4cae011151d76fe6358a91cd1192ab6aeadee..896b6afc958dfd71d075fb4bfb63f2ad0c1f0508 100755
--- a/src/Grid/grid_sm.hpp
+++ b/src/Grid/grid_sm.hpp
@@ -340,20 +340,20 @@ public:
 
 		// Check the sum produce a valid key
 
-		if (check::valid(gk.k[0] + sum_id[0],sz[0]) == false)
+		if (check::valid(gk.get(0) + sum_id[0],sz[0]) == false)
 			return -1;
 
-		lid = gk.k[0] + sum_id[0];
+		lid = gk.get(0) + sum_id[0];
 
 
 		for (mem_id i = 1 ; i < N ; i++)
 		{
 			// Check the sum produce a valid key
 
-			if (check::valid(gk.k[i] + sum_id[i],sz[i]) == false)
+			if (check::valid(gk.get(i) + sum_id[i],sz[i]) == false)
 				return -1;
 
-			lid += (gk.k[i] + sum_id[i]) * sz_s[i-1];
+			lid += (gk.get(i) + sum_id[i]) * sz_s[i-1];
 		}
 
 		return lid;
@@ -377,14 +377,14 @@ public:
 
 		if (bc[0] == NON_PERIODIC)
 		{
-			if (check::valid(gk.k[0] + sum_id[0],sz[0]) == false)
+			if (check::valid(gk.get(0) + sum_id[0],sz[0]) == false)
 				return -1;
 
-			lid = gk.k[0] + sum_id[0];
+			lid = gk.get(0) + sum_id[0];
 		}
 		else
 		{
-			lid = openfpm::math::positive_modulo(gk.k[0] + sum_id[0],sz[0]);
+			lid = openfpm::math::positive_modulo(gk.get(0) + sum_id[0],sz[0]);
 		}
 
 		for (mem_id i = 1 ; i < N ; i++)
@@ -394,14 +394,14 @@ public:
 			/* coverity[dead_error_line] */
 			if (bc[i] == NON_PERIODIC)
 			{
-				if (check::valid(gk.k[i] + sum_id[i],sz[i]) == false)
+				if (check::valid(gk.get(i) + sum_id[i],sz[i]) == false)
 					return -1;
 
-				lid += (gk.k[i] + sum_id[i]) * sz_s[i-1];
+				lid += (gk.get(i) + sum_id[i]) * sz_s[i-1];
 			}
 			else
 			{
-				lid += (openfpm::math::positive_modulo(gk.k[i] + sum_id[i],sz[i])) * sz_s[i-1];
+				lid += (openfpm::math::positive_modulo(gk.get(i) + sum_id[i],sz[i])) * sz_s[i-1];
 			}
 		}
 
@@ -459,11 +459,11 @@ public:
 
 	inline mem_id LinId(const grid_key_dx<N> & gk) const
 	{
-		mem_id lid = gk.k[0];
+		mem_id lid = gk.get(0);
 		for (mem_id i = 1 ; i < N ; i++)
 		{
 			/* coverity[dead_error_begin */
-			lid += gk.k[i] * sz_s[i-1];
+			lid += gk.get(i) * sz_s[i-1];
 		}
 
 		return lid;
diff --git a/src/Grid/iterators/grid_key_dx_iterator_sub.hpp b/src/Grid/iterators/grid_key_dx_iterator_sub.hpp
index c9d52c4c8bc67f3ece9b993d18c400cf64dbd014..660bd81193465373191317b96202967568c17260 100644
--- a/src/Grid/iterators/grid_key_dx_iterator_sub.hpp
+++ b/src/Grid/iterators/grid_key_dx_iterator_sub.hpp
@@ -578,7 +578,7 @@ public:
 	 */
 	inline size_t getVolume()
 	{
-		return Box<dim,long int>::getVolumeKey(gk_start.k, gk_stop.k);
+		return Box<dim,long int>::getVolumeKey(gk_start.get_k(), gk_stop.get_k());
 	}
 
 	/*! \brief Reset the iterator (it restart from the beginning)
diff --git a/src/NN/CellList/CellList.hpp b/src/NN/CellList/CellList.hpp
index 61ba218b37e59562afd9bf4ee6473dd6302a5412..be6c4609d0862e2aa89509c4a710d97fef5d1f91 100644
--- a/src/NN/CellList/CellList.hpp
+++ b/src/NN/CellList/CellList.hpp
@@ -601,6 +601,7 @@ public:
 		static_cast<CellDecomposer_sm<dim,T,transform> &>(*this).swap(cell);
 
 		n_dec = cell.n_dec;
+		from_cd = cell.from_cd;
 
 		return *this;
 	}
@@ -622,6 +623,7 @@ public:
 		static_cast<CellDecomposer_sm<dim,T,transform> &>(*this) = static_cast<const CellDecomposer_sm<dim,T,transform> &>(cell);
 
 		n_dec = cell.n_dec;
+		from_cd = cell.from_cd;
 
 		return *this;
 	}
@@ -913,7 +915,7 @@ public:
 	{
 #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;
+		{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,base>,SYM,impl> cln(cell,p,NNc_sym,*this,v);