fix error in restore functionality