re-implementing last used port auto-select