Fix refs for repeated elements