Fix network endpoint resolution

fix #112
Merge pull request #116 from ggiamarchi/issue#112

Fix network endpoint resolution