Fix thumbnail generation of images