Bugfix in output flushing