Fix RichTreeFactory and tests