fix for crash when deleting temp file