fix detecting gateways