Fixing a problem with the image rotation