Fix incomplete buffer flush.