rbtree debugging seems to be ok, but I can't say it is 100% correct