port numbering bug fix