Corrected XPath expression for root dirs with special chars (refs #2786)
Fixed erroneous sprintf() (refs #2786)