Fix bugs in handling of the .restore directive.