Better gateway detection.