fixed mateReferenceIndex error, now can try on actual mateReferences, perhaps have switch for header