Fix empty port number issue, resolves #705