OSR and the decision rule

I am writing a loop with OSR in order to compute the efficient frontier similar CGG (1999). More specifically, I am changing the weight on inflation in the OSR objective function. Here is the loop part:

for ii = 1:length(piwgtvec)
    set_param_value('piwgt',piwgtvec(ii));
    [oo_.dr,info,M_,options_,oo_] = resol(0,M_,options_,oo_);
    oo_.osr = osr(var_list_,M_.osr.param_names,M_.osr.variable_indices,M_.osr.variable_weights);
    disp(oo_.osr.optim_params);
    info = stoch_simul(var_list_);
    if info
        disp(['Computation failed for piwgt =' num2str(piwgtvec(ii))])
    end
    ygapstd = ModelStdev({'ygapt'},oo_,M_);
    pistd = ModelStdev({'pit'},oo_,M_);
    vol_pairs(ii,:) = [pistd ygapstd];
end

Note that piwgtvect is a vector of weights on inflation and ModelStdev is my own function that allows me to pull the relevant standard deviations. Am I doing this correctly? I have a suspicion that I have not manage to get Dynare to resolve the model and compute the new standard deviations…

That snippet looks OK, but it is hard to tell without the full files to run.

Thank you!