Fix the buffer construction