fix race condition in queue sink