fix flush behavior