Uh-oh, this is not working fully after all.
Sometimes it still happens that a new entity (created after the old, followed one had been removed) is detected as the old entity. As if the new entity got both the same handle and the same pointer as the old one, such that the equality of original pointer and the pointer obtained by handle still holds. Any further ideas?