Security enhancements

fix some potential hole
Merge pull request #6 from zvn/master

Security enhancements