Added detection for network connection