more elegant way to accomplish that, also prevent empty hostname set from failing