Fixed bug when image data is empty