kcc: correctly calculate the number of components