fixed "index out of range" bug for bin.distr.