Fix crash when menu items are changed.