making isConnected more accurate