fix buffer control