improve external ip function