fix undo and redo