fix retrieving image dimensions