Fix segfault when saving the game.