better way to check connection status