Fixed problem with bucket_indices not starting from 0.