Fixes #566
cleanup code getting host name