improve buffered output

- use the same buffer size if wrapping a buffered output
- directly call flush on the checksum wrapper