Fix validate code