Several queue bugfixes