added a function to keep ports of current up to date