fixing a bug that created a loop for the menus