revised codes, correct output of vtk