Fixed bug where game would not end properly