fix compile errors in file system main
refactor open_file