Fix issue where id was only assigned if there was no fqdn

Fix from #4422