fixed error if the image is empty