Fix up validation code