check for connectivity only when needed