Fixed handling of image type