improved ip check