Fix the backup/restore feature of shallow_flash.sh

- base on #279
- ref: #239