Added checking of internet connection