Fixed rotate bug and added checks