diff --git a/matlab/+occbin/solve_two_constraints.m b/matlab/+occbin/solve_two_constraints.m
index 55fff162d7501edf1f93ba9a6b14cb180229febf..80744ac50943fa24b2e3ee285cb7ad3d3c587152 100644
--- a/matlab/+occbin/solve_two_constraints.m
+++ b/matlab/+occbin/solve_two_constraints.m
@@ -234,6 +234,7 @@ for shock_period = 1:n_shocks_periods
                 err_relax = err_relaxed_constraint_new(relaxed_constraint_new & my_binding_indicator(:));
                 max_err(iter) = max(abs([err_violation;err_relax]));
                 regime_change_this_iteration = true;
+                regime_violates_constraint_in_expectation(iter) = any(binding_constraint_new & ~binding_indicator(:));
             else
                 regime_change_this_iteration = false;
                 max_err(iter) = 0;