rotate image - fix bugs