fixed crash when validating non string data

fixes #3087
Merge pull request #3491 from cebe/fix-3087

fixed crash when validating non string data