[#1558] Use correct scheme to detect port. Thanks @golovnin for spotting it.