Fix bug about saving data on file