Fix bug with too high port numbers