added proper hostname support