fix upside down image generation
fix minor issues