remove unnecessary format and enshure good values of some important variables when saving to file