test for saving data in file, need to be checked.