diff --git a/matlab/+mom/default_option_mom_values.m b/matlab/+mom/default_option_mom_values.m
index 5ce9d34a94e491d76a27b9fb754a4d2c6dccf850..6d3c7fe2eedf2f504473513e5a0457baf660d85e 100644
--- a/matlab/+mom/default_option_mom_values.m
+++ b/matlab/+mom/default_option_mom_values.m
@@ -1,5 +1,5 @@
-function options_mom_ = default_option_mom_values(options_mom_, options_, dname, do_bayesian_estimation)
-% options_mom_ = default_option_mom_values(options_mom_, options_, dname, do_bayesian_estimation)
+function options_mom_ = default_option_mom_values(options_mom_, options_, dname, fname, do_bayesian_estimation)
+% options_mom_ = default_option_mom_values(options_mom_, options_, dname, fname, do_bayesian_estimation)
 % -------------------------------------------------------------------------
 % Returns structure containing the options for method_of_moments command.
 % Note 1: options_mom_ is local and contains default and user-specified
@@ -16,6 +16,7 @@ function options_mom_ = default_option_mom_values(options_mom_, options_, dname,
 %  o options_mom_:           [structure]  all user-specified settings (from the method_of_moments command)
 %  o options_:               [structure]  global options
 %  o dname:                  [string]     default name of directory to store results
+%  o fname:                  [string]     default name of mod file
 %  o do_bayesian_estimation  [boolean]    indicator whether we do Bayesian estimation
 % -------------------------------------------------------------------------
 % OUTPUTS
@@ -453,8 +454,8 @@ if strcmp(mom_method,'IRF_MATCHING') && do_bayesian_estimation
         warning('method_of_moments: You specified mh_tune_jscale, but the maximum number of iterations is smaller than the step size. No update will take place.')
     end
     if options_mom_.load_results_after_load_mh
-        if ~exist([options_mom_.dirname filesep 'method_of_moments' filesep M_.fname '_mom_results.mat'],'file')
-            fprintf('\nYou specified the ''load_results_after_load_mh'' option, but no ''%s_mom_results.mat'' file\n',M_.fname);
+        if ~exist([options_mom_.dirname filesep 'method_of_moments' filesep fname '_mom_results.mat'],'file')
+            fprintf('\nYou specified the ''load_results_after_load_mh'' option, but no ''%s_mom_results.mat'' file\n',fname);
             fprintf('was found in the folder %s%smethod_of_moments.\n',options_mom_.dirname,filesep);
             fprintf('Results will be recomputed and option ''load_results_after_load_mh'' is reset to false.\n');
             options_mom_.load_results_after_load_mh = false;
diff --git a/matlab/+mom/run.m b/matlab/+mom/run.m
index bbcd1cc9bfea9189331c42717ec9011b206a4fd6..de04e839850365b5f1b7b9df97d4f62672a35564 100644
--- a/matlab/+mom/run.m
+++ b/matlab/+mom/run.m
@@ -161,7 +161,7 @@ check_varobs_are_endo_and_declared_once(options_.varobs,M_.endo_names);
 % The idea is to be independent of options_ and have full control of the
 % estimation instead of possibly having to deal with options chosen somewhere
 % else in the mod file.
-options_mom_ = mom.default_option_mom_values(options_mom_, options_, M_.dname, do_bayesian_estimation);
+options_mom_ = mom.default_option_mom_values(options_mom_, options_, M_.dname, M_.fname, do_bayesian_estimation);
 
 
 % -------------------------------------------------------------------------