restore on first login if a backup is present
fix bugs in restore process