Fixed a problem with alternating undo and redo actions