Fix output_buffer bug