Added tests from README
Fixed a bug.

Shold have clear buffer when commit.
Fixed bugs in test cases
Update test cases