output buffer bug fix