fix bug in clustering weights