Fix some plain old Javascript gotchas

Don't use the toString method which may not exist
Re-initialize the value for validatorErr every loop iteration