add some tests
fix flush