add validation fuction

add validation fuction