fixed a bug that wiped files clean