change return values of tree functions from labeltype to position/index