Fixed bug with image rotation