Fixed issue detecting connection status.