Fix stackoverflow with an IdentityHashMap