Fixed issue building context menu items when there are lots of nested sub-menus.