bug fixing for weighted and unweighted prediction