More fixes for WritePixels