Fix the port connection functionality.