Fixed bug when checking for menuitem.