performance fix for getPixelData()