Clean references to dead entities