call callback in flush