Made valid.m more valid.
Merge pull request #7 from ijansch/master

Made valid.m more valid.