Fix port allocation script