add minimum buffer size
Merge pull request #855 from sijchen/bufferlencheck_fixe

add minimum buffer size (same to #854)