Fix invalid port and URL ends with /