fixed issues with refreshing and ending the game