Added if then statement to restore file.