added check of internet connection