support flush on STDOUT/STDERR (fix #172)