Ensure becomes replaces instances in the identity map.

[ fix #2787 ]