Keep the stack unchanged after registering modules.
Fix segfault when leaving a game not initialized yet.
Fix stack leak.