clean code
Fix Segament fault
Merge pull request #1 from pichuang/master

Clean code and fix bug