Fixed ABA bug in the queues as reported by Adam Morrison.