improved ip validation