added flushing of stdout to allow immediate consumption by simulated device