added ipaddr validation logic