Tiny improvement to string checking.
Merge pull request #1372 from rhattersley/fix-str-check

Tiny improvement to string checking.