fix buffer reusing problem. Issue #8.