merge undo / redo steps correctly