Fixed rotate function bug.