fixed port number handling for URLs