Fix validate class, and add error messages to validation.