Fix parallel duplicating input when no output is produced. (#58)

Also simplify flush_buffer() logic, getting rid of the `complete`
parameter in the virtual method signature.