implement flush