Improve error checking when Internet connection is lost.