fix getImageData crash