Fix undo manager