improved host parsing