Fix handling of hosts for the common case where the hostname has no dots.

This broke recently with changes to issue-22.

When the initial hostname has no dots, dotIdx is -1. The
host.substring call then throws an exception and registration of this
host is bypassed.

While this section of code could be cleaned up further, a simple fix
here is to only attempt the substring if dotIdx is actually positive
(that is, if the host had some dots).