define $tldTree inside function instead of relying on global which can be disabled close #1