Fix undo and toolbar updates in some cases.