fixed: reset the port index when retrieving the ports fails