fixed bugs of saving file and opening same file.