Fixed a thread bug for undo/redoing rotation