fixed possible null deref in enqueue/dequeue. swapped in rbtree for temp impl