Define treeLoadCallback outside loop body

No change in functionality