implement flush()