add check
fix some error
change to sub weighted mean