Fixed null hostname case, removed setHeader hack