fix race condition with consumers of the queue