This modifies the way the error message is generated and should avoid an error 500 when port is not a number.