Fixed exception when casting menuItem to button