Add some validate functions
Merge pull request #109 from miraclesu/valid

Add some validate functions