Fix undo issue