Fixed bug when undoing switch orientation.