Added checks to prevent the joining-dead-game bug.