Now detects loss of connection better.