diff --git a/src/Graph/CartesianGraphFactory.hpp b/src/Graph/CartesianGraphFactory.hpp
index 25e099f4e34141ba423c1fc0bfcddbefc284f7dc..c8c9568c8ce6af8579793b23f63696f9c70712bd 100644
--- a/src/Graph/CartesianGraphFactory.hpp
+++ b/src/Graph/CartesianGraphFactory.hpp
@@ -10,8 +10,9 @@
 
 #include "map_vector.hpp"
 #include "map_graph.hpp"
-#include "grid.hpp"
+#include "Grid/grid.hpp"
 #include "Space/Shape/Box.hpp"
+#include "Space/Shape/HyperCube.hpp"
 
 /*! \brief This class work as a functor
  *
diff --git a/src/dec_optimizer.hpp b/src/dec_optimizer.hpp
index 3eeba6451ce7868e7c9fa9daad0b945bfefa9d85..7ae526a5d86167786faffe6d3b3e0acdd140ddc0 100644
--- a/src/dec_optimizer.hpp
+++ b/src/dec_optimizer.hpp
@@ -59,7 +59,7 @@ public:
 	 *
 	 */
 
-	template<typename encap> static Box<dim,size_t> getBox(encap & enc)
+	template<typename encap> static Box<dim,size_t> getBox(encap && enc)
 	{
 		Box<dim,size_t> bx;
 
@@ -80,7 +80,7 @@ public:
 	 *
 	 */
 
-	template<typename encap> static void getBox(encap & enc, Box<dim,size_t> & bx)
+	template<typename encap> static void getBox(const encap & enc, Box<dim,size_t> & bx)
 	{
 		// Create the object from the encapsulation
 
@@ -145,7 +145,7 @@ private:
 	 *
 	 */
 
-	template<unsigned int p_sub> void fill_domain(Graph & graph, Box<dim,size_t> & box, size_t ids)
+	template<unsigned int p_sub> void fill_domain(Graph & graph,const Box<dim,size_t> & box, size_t ids)
 	{
 		// Create a subgrid iterator
 		grid_key_dx_iterator_sub<dim> g_sub(gh,box.getKP1(),box.getKP2());
@@ -283,11 +283,15 @@ private:
 					// get the wavefront sub-domain id
 					size_t sub_w = gh.LinId(it.get());
 
+					// get the sub-domain id of the expanded wavefront
+					grid_key_dx<dim> k_exp = it.get() + w_comb[d];
+					size_t sub_w_e = gh.LinId(k_exp);
+
 					// we get the processor id of the neighborhood sub-domain on direction d
-					size_t exp_p = graph.vertex(graph.getChild(sub_w,d)).template get<p_id>();
+					size_t exp_p = graph.vertex(sub_w_e).template get<p_id>();
 
 					// we check if it is the same processor id
-					w_can_expand &= exp_p != domain_id;
+					w_can_expand &= exp_p == domain_id;
 
 					// next domain
 					++it;
@@ -310,9 +314,6 @@ private:
 					{
 						v_w.template get<wavefront<dim>::stop>(d)[j] = v_w.template get<wavefront<dim>::stop>(d)[j] + w_comb[d].c[j];
 						v_w.template get<wavefront<dim>::start>(d)[j] = v_w.template get<wavefront<dim>::start>(d)[j] + w_comb[d].c[j];
-
-						std::cout << "stop: " << v_w.template get<wavefront<dim>::stop>(d)[j] << "\n";
-						std::cout << "start: " << v_w.template get<wavefront<dim>::start>(d)[j] << "\n";
 					}
 
 					// expand the intersection of the wavefronts
@@ -346,9 +347,9 @@ private:
 						for (int s = 0 ; s < dim ; s++)
 						{
 							if (is_pos == true)
-							{v_w.template get<wavefront<dim>::stop>(id)[j] = v_w.template get<wavefront<dim>::stop>(d)[j] + w_comb[id].c[j];}
+							{v_w.template get<wavefront<dim>::stop>(id)[j] = v_w.template get<wavefront<dim>::stop>(id)[j] + w_comb[id].c[j];}
 							else
-							{v_w.template get<wavefront<dim>::start>(id)[j] = v_w.template get<wavefront<dim>::start>(d)[j] + w_comb[id].c[j];}
+							{v_w.template get<wavefront<dim>::start>(id)[j] = v_w.template get<wavefront<dim>::start>(id)[j] + w_comb[id].c[j];}
 						}
 					}
 				}
diff --git a/src/dec_optimizer_unit_test.hpp b/src/dec_optimizer_unit_test.hpp
index 7ab5aa2099f8a8e6d54a4a25c07de512e464e387..31818a6060cf5e56a9faa354bf37ff9f316c41aa 100644
--- a/src/dec_optimizer_unit_test.hpp
+++ b/src/dec_optimizer_unit_test.hpp
@@ -26,9 +26,9 @@ BOOST_AUTO_TEST_CASE( dec_optimizer_test_use)
 
 	// Cartesian grid
 	std::vector<size_t> sz;
-	sz.push_back(4);
-	sz.push_back(4);
-	sz.push_back(1);
+	sz.push_back(GS_SIZE);
+	sz.push_back(GS_SIZE);
+	sz.push_back(GS_SIZE);
 
 	// Box
 	Box<3,float> box({0.0,0.0,0.0},{1.0,1.0,1.0});
diff --git a/src/grid_dist.hpp b/src/grid_dist.hpp
index 23658bad8e816a5ae61ba6285a2f39bad82c6de4..728d5f6146f436dd4f2e20d98cb009b0e9c2ec84 100644
--- a/src/grid_dist.hpp
+++ b/src/grid_dist.hpp
@@ -2,7 +2,7 @@
 #define COM_UNIT_HPP
 
 #include <vector>
-#include "map_grid.hpp"
+#include "Grid/map_grid.hpp"
 #include "VCluster.hpp"
 #include "Space/SpaceBox.hpp"