Fixed the end game bug