Fix calling try_delete before importing it.

Previously, the import of try_delete was after one of the blocks
of code that called it, so it could result in an error at runtime.
Merge pull request #1032 from waywardmonkeys/fix-try-delete

Fix calling try_delete before importing it.