undo and redo fix