fixed some file management