diff --git a/matlab/dsge_var_likelihood.m b/matlab/dsge_var_likelihood.m
index 48e03c34195df1991577bfab4cefd0bcbd884a88..94f8e21ac46d93c0675a06f5c6779bafedcab149 100644
--- a/matlab/dsge_var_likelihood.m
+++ b/matlab/dsge_var_likelihood.m
@@ -233,6 +233,15 @@ assignin('base','GYX',GYX);
 iGXX = inv(GXX);
 PHI_star = iGXX*transpose(GYX); %formula (22), DS (2004)
 SIGMA_u_star=GYY - GYX*PHI_star; %formula (23), DS (2004)
+[SIGMA_u_star_is_positive_definite, penalty] = ispd(SIGMA_u_star);
+if ~SIGMA_u_star_is_positive_definite
+    fval = Inf;
+    info(1) = 53;
+    info(4) = penalty;
+    exit_flag = 0;
+    return;
+end
+
 if ~isinf(dsge_prior_weight)% Evaluation of the likelihood of the dsge-var model when the dsge prior weight is finite.
     tmp0 = dsge_prior_weight*NumberOfObservations*TheoreticalAutoCovarianceOfTheObservedVariables(:,:,1) + mYY ;  %first term of square bracket in formula (29), DS (2004)
     tmp1 = dsge_prior_weight*NumberOfObservations*GYX + mYX;        %first element of second term of square bracket in formula (29), DS (2004)
diff --git a/matlab/print_info.m b/matlab/print_info.m
index af5b40fc8d6a21948b5c080ac8c9ee4fe6afa375..e66b2e82a0983f82d5137da1ee6c6d56d8147093 100644
--- a/matlab/print_info.m
+++ b/matlab/print_info.m
@@ -122,7 +122,9 @@ if ~noprint
         fprintf('\n The dsge_prior_weight is dsge_var=%5.4f, but must be at least %5.4f for the prior to be proper.\n',info(2),info(3));
         error('You are estimating a DSGE-VAR model, but the value of the dsge prior weight is too low!')
       case 52 %dsge_var_likelihood
-        error('You are estimating a DSGE-VAR model, but the implied covariance matrix of the VAR''s innovations is not positive definite!');
+        error('You are estimating a DSGE-VAR model, but the implied covariance matrix of the VAR''s innovations, based on artificial and actual sample is not positive definite!');
+      case 53 %dsge_var_likelihood
+        error('You are estimating a DSGE-VAR model, but the implied covariance matrix of the VAR''s innovations, based on the artificial sample, is not positive definite!');
       case 55
         error('Fast Kalman filter only works with stationary models [lik_init=1] or stationary observables for non-stationary models [lik_init=3]')
       case 61 %Discretionary policy