Unlike the preceeding attempted fix, this version avoids the potential for converting an invalid bin index to a size class.