Fix restoring algorithm