Fixed a couple of search/replace lapses, removed unnecessary logging code, added checks to user-defined xpath queries. Thanks Ross for pointing me to that, closes #580