corrected writeRaster error