Better check for non-numbers

Resolves #5304.
Merge pull request #5 from jdswinbank/iss5304

Better check for non-numbers