fix flush method
improve test coverage
fix missing teardown flush