Fixed serious bug: sigma_g always reset to one