fix buffer operations