fixed bug in pgm and ppm write