centroid computation not working