bug fix in, nbins defined as const int