fix several issues
Merge pull request #46 from juniwang/master

fix several issues