fixed bug in flush