Added: more checks and debug info in TcpConnection.