Added some checks for internet connection.