Fix bug which caused images to be TOP-BOTTOM flipped