add save method and restore method