XPath cleanup

Fix build errors and warnings