move hostname presence check to better location