Added in code to protecte against invalid query selectors resulting from incomplete regex