fixed multiple instantiation of socket, improper passing of port, etc