fixed TCP client code