updating remove operations in undo code