added network connection detection