bug fix in rotate