added a network connection check