Improve and fix backup&restore.