Fix error when InMemoryQueue is empty