Added error handling for no internet connection