Fixed minor issues in tcp and socket