Handle gethostname error and set host to 127.0.0.1
Merge branch 'fix/gethostname'