Not sure if I'm doing something wrong, but I'm getting segmentation fault every time I click on a menu item 