This bug only manifested with this data structure because I was doing something different. This is not a bug in the normal sense but an unfortunate event caused by the refcount structure and the queue implementation. They need to go together otherwise there is no point in changing the refcount structure.