add some functions and fix.
Merge pull request #38 from jiegec/master

add some functions and fix.