fix buffer to chain conversion