fix validate code bug