beef up error checking in validate()