savebuff: handle query buffers