Fix some issues with clear rewritten ports