Fix reference equality bug

References were still using the `id` method to check equality