added check for internet connectivity