fix check for closed network connection