Fix save image and flip of image