Fix undo feature