Fixed various bugs with rotation