fix buffer length