Fixed #169 - Fix error caused by accessing null.hostname
This fix is somewhat speculative as I can only randomly reproduce the issue, but from looking at all the code where we potentially access the hostname
property this seems to be the only code path whether the value can possibly be null
(unless I missed something).