Fix crash on delete file; behavior is probably still wrong.