I tried it myself. Now I can say, why you got back to the mainmenu: You made the value of the pizzas you have left so high that it was to big to be stored as an integer. So it was set to 0. That means you died and so you got back to the mainmenu :)