fix #30, #27
Merge pull request #31 from xiechao06/issue30

fix #30, #27