Fixed port extraction. Now supports hostname, hostname + port, ipv4, ipv4 + port, ipv6, ipv6 + port Fixes #1571