set correct handling of extractHostName
issue 39: fix code review
Merge pull request #42 from yvasileuski/issue39

set correct handling of extractHostName