Fixing delete file bugs