Fixed bug while rotating device