bug fix: no more segmentation fault after exiting the game