Fix null pointer exceptions if network is down or service is not responding.