Fix XPath implementation throwing exception