Various fixes about exitting and endgame