Merge pull request #8 from chengsun/master

More bug fixes