fixes #2246 deleting an environment also deletes associated templates