Fix a resolving exception when adding invalid references as a reference destination.

Closes #411