fixed a subtle bug in make_mVal_fun