fix memory leak when creating XPath evaluators in threads
merge 3.2 branch