Fixed some file management errors