Bugfix in the get_barycenter function.