fixed bugs related to tracking the last used port
v1.2.2