Prevent NullReferenceException in case of missing Host

Do not throw a NullReferenceException when Host variable is not set.
Ignore the calls to RegisterObject and UnregisterObject instead.
Shouldn't the second call be UnregisterObject () ?