added condition to  end getgame.