diff --git a/configure.ac b/configure.ac
index 80597d776f91a39b8040e34b079daa44a6f533e7..0406ea4a18b5c0a7bb5d07c1878f5b2d7a044ce4 100755
--- a/configure.ac
+++ b/configure.ac
@@ -75,7 +75,7 @@ AC_ARG_WITH([pdata],
 
 ####### include openfpm_devices include path
 
-INCLUDES_PATH+="-I. -Iconfig -I../../openfpm_data/src -I../../openfpm_devices/src -I$pdata_dir "
+INCLUDES_PATH+="-I. -Iconfig -I../../openfpm_data/src -I../../openfpm_devices/src -I../../openfpm_vcluster/src -I$pdata_dir "
 
 ########
 
diff --git a/src/VTKWriter_dist_graph.hpp b/src/VTKWriter_dist_graph.hpp
index b38d17e4e4d4d8d6a83a4dd1ca5ccfc6a04a018b..b07269a3c4ad3b6ef38a17850b1c51c9a4dda2d5 100644
--- a/src/VTKWriter_dist_graph.hpp
+++ b/src/VTKWriter_dist_graph.hpp
@@ -8,6 +8,8 @@
 #ifndef VTKWRITER_DIST_GRAPH_HPP_
 #define VTKWRITER_DIST_GRAPH_HPP_
 
+#include "VCluster.hpp"
+
 /*! Property data store for scalar and vector
  *
  */
@@ -881,7 +883,7 @@ struct dist_prop_out_edge
 template<typename Graph>
 class VTKWriter<Graph, DIST_GRAPH>
 {
-	const Graph & g;
+	Graph & g;
 
 	/*! \brief It get the vertex properties list
 	 *
@@ -996,7 +998,7 @@ class VTKWriter<Graph, DIST_GRAPH>
 			vtk_dist_vertex_node<Graph, attr> vn(v_out, obj, x);
 
 			// Iterate through all the vertex and create the vertex list
-			boost::mpl::for_each<boost::mpl::range_c<int, 0, Graph::V_type::max_prop - 1> >(vn);
+			boost::mpl::for_each<boost::mpl::range_c<int, 0, Graph::V_type::max_prop> >(vn);
 
 			// write the node string
 			vn.write();
@@ -1100,7 +1102,7 @@ public:
 	 * \param g Graph to write
 	 *
 	 */
-	VTKWriter(const Graph & g) :
+	VTKWriter(Graph & g) :
 			g(g)
 	{
 	}
@@ -1117,116 +1119,137 @@ public:
 
 	template<int prp = -1> bool write(std::string file, std::string graph_name = "Graph", file_type ft = file_type::ASCII)
 	{
-		// Check that the Vertex type define x y and z attributes
 
-		if (has_attributes<typename Graph::V_type>::value == false)
-		{
-			std::cerr << "Error writing a graph: Vertex must has defines x,y,z properties" << "\n";
-			return false;
-		}
+		Vcluster & v_cl = *global_v_cluster;
 
-		// Header for the vtk
-		std::string vtk_header;
-		// Point list of the VTK
-		std::string point_list;
-		// Vertex list of the VTK
-		std::string vertex_list;
-		// Graph header
-		std::string vtk_binary_or_ascii;
-		// Edge list of the GraphML
-		std::string edge_list;
-		// vertex properties header
-		std::string point_prop_header;
-		// edge properties header
-		std::string vertex_prop_header;
-		// edge properties header
-		std::string edge_prop_header;
-		// Data point header
-		std::string point_data_header;
-		// Ids point
-		std::string point_ids;
-		// Data point
-		std::string point_data;
-		// Cell data header
-		std::string cell_data_header;
-		// Cell data
-		std::string cell_data;
-
-		// VTK header
-		vtk_header = "# vtk DataFile Version 3.0\n" + graph_name + "\n";
-
-		// Choose if binary or ASCII
-		if (ft == file_type::ASCII)
-		{
-			vtk_header += "ASCII\n";
-		}
-		else
+		g.deleteGhosts();
+
+		if (v_cl.getProcessUnitID() == 0)
 		{
-			vtk_header += "BINARY\n";
+			for (size_t i = 0; i < g.getTotNVertex(); ++i)
+			{
+				g.reqVertex(i);
+			}
 		}
 
-		// Data type for graph is DATASET POLYDATA
-		vtk_header += "DATASET POLYDATA\n";
-
-		// point properties header
-		point_prop_header = get_point_properties_list();
-
-		// Get point list
-		point_list = get_point_list<has_attributes<typename Graph::V_type>::value>();
-
-		// vertex properties header
-		vertex_prop_header = get_vertex_properties_list();
-
-		// Get vertex list
-		vertex_list = get_vertex_list();
-
-		// Edge properties header
-		edge_prop_header = get_edge_properties_list();
-
-		// Get the edge graph list
-		edge_list = get_edge_list();
-
-		// Get the point data header
-		point_data_header = get_point_data_header();
+		g.sync();
 
-		// Get the point info
-		point_ids = get_point_info();
-
-		// Get the cell data header
-		cell_data_header = get_cell_data_header();
-
-		// For each property in the vertex type produce a point data
-
-		dist_prop_out_vertex<Graph> pp(point_data, g);
-
-		if (prp == -1)
-			boost::mpl::for_each<boost::mpl::range_c<int, 0, Graph::V_type::max_prop> >(pp);
-		else
-			boost::mpl::for_each<boost::mpl::range_c<int, prp, prp> >(pp);
-
-		// For each property in the edge type produce a point data
-
-		dist_prop_out_edge<Graph> ep(cell_data, g);
-
-		if (prp == -1)
-			boost::mpl::for_each<boost::mpl::range_c<int, 0, Graph::E_type::max_prop> >(ep);
-		else
-			boost::mpl::for_each<boost::mpl::range_c<int, prp, prp> >(ep);
-
-		// write the file
-		std::ofstream ofs(file);
-
-		// Check if the file is open
-		if (ofs.is_open() == false)
+		if (v_cl.getProcessUnitID() == 0)
 		{
-			std::cerr << "Error cannot create the VTK file: " + file;
-		}
-
-		ofs << vtk_header << point_prop_header << point_list << vertex_prop_header << vertex_list << edge_prop_header << edge_list << point_data_header << point_ids << point_data << cell_data_header << cell_data;
+			// Check that the Vertex type define x y and z attributes
+
+			if (has_attributes<typename Graph::V_type>::value == false)
+			{
+				std::cerr << "Error writing a graph: Vertex must has defines x,y,z properties" << "\n";
+				return false;
+			}
+
+			// Header for the vtk
+			std::string vtk_header;
+			// Point list of the VTK
+			std::string point_list;
+			// Vertex list of the VTK
+			std::string vertex_list;
+			// Graph header
+			std::string vtk_binary_or_ascii;
+			// Edge list of the GraphML
+			std::string edge_list;
+			// vertex properties header
+			std::string point_prop_header;
+			// edge properties header
+			std::string vertex_prop_header;
+			// edge properties header
+			std::string edge_prop_header;
+			// Data point header
+			std::string point_data_header;
+			// Ids point
+			std::string point_ids;
+			// Data point
+			std::string point_data;
+			// Cell data header
+			std::string cell_data_header;
+			// Cell data
+			std::string cell_data;
+
+			// VTK header
+			vtk_header = "# vtk DataFile Version 3.0\n" + graph_name + "\n";
+
+			// Choose if binary or ASCII
+			if (ft == file_type::ASCII)
+			{
+				vtk_header += "ASCII\n";
+			}
+			else
+			{
+				vtk_header += "BINARY\n";
+			}
+
+			// Data type for graph is DATASET POLYDATA
+			vtk_header += "DATASET POLYDATA\n";
+
+			// point properties header
+			point_prop_header = get_point_properties_list();
+
+			// Get point list
+			point_list = get_point_list<has_attributes<typename Graph::V_type>::value>();
+
+			// vertex properties header
+			vertex_prop_header = get_vertex_properties_list();
+
+			// Get vertex list
+			vertex_list = get_vertex_list();
+
+			// Edge properties header
+			edge_prop_header = get_edge_properties_list();
+
+			// Get the edge graph list
+			edge_list = get_edge_list();
+
+			// Get the point data header
+			point_data_header = get_point_data_header();
+
+			// Get the point info
+			point_ids = get_point_info();
+
+			// Get the cell data header
+			cell_data_header = get_cell_data_header();
+
+			// For each property in the vertex type produce a point data
+
+			dist_prop_out_vertex<Graph> pp(point_data, g);
+
+			if (prp == -1)
+				boost::mpl::for_each<boost::mpl::range_c<int, 0, Graph::V_type::max_prop> >(pp);
+			else
+				boost::mpl::for_each<boost::mpl::range_c<int, prp, prp> >(pp);
+
+			// For each property in the edge type produce a point data
+
+			dist_prop_out_edge<Graph> ep(cell_data, g);
+
+			if (prp == -1)
+				boost::mpl::for_each<boost::mpl::range_c<int, 0, Graph::E_type::max_prop> >(ep);
+			else
+				boost::mpl::for_each<boost::mpl::range_c<int, prp, prp> >(ep);
+
+			// write the file
+			std::ofstream ofs(file);
+
+			// Check if the file is open
+			if (ofs.is_open() == false)
+			{
+				std::cerr << "Error cannot create the VTK file: " + file;
+			}
+
+			ofs << vtk_header << point_prop_header << point_list << vertex_prop_header << vertex_list << edge_prop_header << edge_list << point_data_header << point_ids << point_data << cell_data_header << cell_data;
+
+			// Close the file
+
+			ofs.close();
 
-		// Close the file
+		}
 
-		ofs.close();
+		g.deleteGhosts();
 
 		// Completed succefully
 		return true;
diff --git a/src/VTKWriter_graph.hpp b/src/VTKWriter_graph.hpp
index a3a61529bf8c78e5dc2c1487ec6cbee0b8c42910..8f59d13f134522c5e46947e26b8c1a001cd312cf 100644
--- a/src/VTKWriter_graph.hpp
+++ b/src/VTKWriter_graph.hpp
@@ -971,7 +971,7 @@ class VTKWriter<Graph, GRAPH>
 			vtk_vertex_node<Graph, attr> vn(v_out, obj, x);
 
 			// Iterate through all the vertex and create the vertex list
-			boost::mpl::for_each<boost::mpl::range_c<int, 0, Graph::V_type::max_prop - 1> >(vn);
+			boost::mpl::for_each<boost::mpl::range_c<int, 0, Graph::V_type::max_prop> >(vn);
 
 			// write the node string
 			vn.write();
diff --git a/src/main.cpp b/src/main.cpp
index b36f2912e5cca499f1cd4100011aaf9fd39cdee0..7f156ab1716fc48d281fb667bce3fcb747f565a9 100755
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -6,6 +6,8 @@
 #define BOOST_TEST_MODULE "C++ test module for OpenFPM_io project"
 #include <boost/test/included/unit_test.hpp>
 
+#include "VCluster.hpp"
 #include "CSVWriter_unit_tests.hpp"
 #include "GraphMLWriter_unit_tests.hpp"
 #include "VTKWriter_unit_tests.hpp"
+