refine code, rename BytesBuffer.buffer to buf