fix port allocation issue