Fix thumbnail generation handler