port image_data fixes from image_data_any branch