Fixed file deletion on disk and in the database.