Backup/restore environment variables: globals and static vars