Changes for saving data after shutdown