fix an issue with port assignment