fix where some tests would fail due to unflushed output