fixed main tree mining fn [ci skip]