Fix isConnected bug