fixed ValidIP function.