fixed scoping bug in CentroidModel