Fix same reference deletion.
Merge pull request #903 from ESwordTheCat/hWvbOvDa

Fix same reference deletion.