fix crash bug when specifying custom server port