Fixed centroid bug in Foundation