validate code