optimisation for checking internet connection