fix SEGV at the end of the game