-Fixed reference loop checking (check reference, not equality)