fix bucket index math