Improved error checking for when connection to the game server or the master server is lost.

@bsoetaer 
Minor changes.