bugfix: fix buffer length bug