fix infinite block while waiting for the queue