Add more tests for queues and fix the bugs they found