diff --git a/matlab/estimation/dynare_estimation_init.m b/matlab/estimation/dynare_estimation_init.m
index 13c1c9e8328ec63c1e0fd124b7b2fbd2f421279f..f51fb40d18c37c98f402aa1f4d1823195057ed0f 100644
--- a/matlab/estimation/dynare_estimation_init.m
+++ b/matlab/estimation/dynare_estimation_init.m
@@ -149,7 +149,7 @@ if ~isempty(bayestopt_) && any(bayestopt_.pshape==0) && any(bayestopt_.pshape~=0
     error('Estimation must be either fully ML or fully Bayesian. Maybe you forgot to specify a prior distribution.')
 end
 % Check if a _prior_restrictions.m file exists
-if exist([M_.fname '_prior_restrictions.m'])
+if exist([M_.fname '_prior_restrictions.m'],'file')
     options_.prior_restrictions.status = 1;
     options_.prior_restrictions.routine = str2func([M_.fname '_prior_restrictions']);
 end