use scoped_buf unstead of vector<char>