Merge pull request #5215 from cypof/fix_restore