bugfix: check that public_hostname is not none before trying to iterate on it.