modify weightFunc