Add support for undeleting references (Fixes #2193)

Deleted references should be accessible via an explicit reference in a script, and can be undeleted using "setdelete 0". Also the Resurrect function implicitely undeletes the given reference.