Fixed an image flipping bug