fixed bug in rotate