Fixing issues when deleting files.