correct treeFold, need maxFun