Fixed bug in binning code.