Undo handling after edit