add a way to check the validity of IP address.