fix sprofile_tree for changed sortperm behaviour

* `sortperm` now only returns `p` (see issue #2160)