corrected bug when writting pvd file