More robust task deletion

I'd encode this setting in an environment variable so it's easy to change later.