modified js to get undifined menu items not to show up