Fixed host parsing to better handle IPv6 hosts