Fix parsing of reference XML