Fix issue causing invalid hostnames to be sent to servers lacking ports
Merge master