How to backup and restore retentive variables