Was dividing running sum of vectors by the total number of elements, not by the number of selected elements, as it should have.
Was dividing running sum of vectors by the total number of elements, not by the number of selected elements, as it should have.