Fix the ReferencePosition comparator
Merging in Matt's fix for the ReferencePosition comparator.