fixed bugs in buffers