flush implemented properly