Allow deleting procedures with recursive references

Fixes #302.