Add save function to recover a dying program.