move stdout flushing