fix: correctly calculate weights