modify the kmeans and dbscan clustering method