update the code for validate