I just fixed the metropolis code (random_walk_metropolis_hastings.m, random_walk_metropolis_hastings_core.m and metropolis_hastings_initialization. m)
We were using both varargin and global so M_, options_, bayestopt_, estim_params_, oo_ we once passed using varargin and and accessed using global. In particular, changes made to bayestopt_.penalty was not passed to called functions.
It is obviously very dangerous and confusing. We have to get rid of globals, but, in the mean time, we should never, never use global and varargin in the same function.
Best
Michel