fixed the failure of connection to host
removed unnecessary testing code