Merge fixes from yago-naga/ternarytree to forcebrute/ternarytree

Merge fixes from yago-naga/ternarytree to forcebrute/ternarytree