Fixed bug in UNDO/REDO