buffer and record