update undo-plugin logic