add image data validation when loading image data