Bug fixes for rotation