xref: some code clean up and a bugfix in attribute name