minor fix in calculating weights "as tadbit". Add corresponding test.