instead using sync, wait for flush