complete input validation
Merge pull request #64 from chiaS/master

complete input validation