changed nBins, restricted size of bins[]