fix buf creation