Fix InMemoryQueue and associated tests.