better port handling