Avoid flushing buffer twice