BUGFIX:Crash when painting centroids