Fixed some file management