fixed undef var errors, added code for removal of xml:base attributes again, refs #519