Use xpath lookup, avoid attributerrors, fixes #402