Fix Undefined offset notice

Also removed some dead code that never ran, there is no variable named
"$buckets" so it'll never have an offset.

Bug: 45327
Change-Id: I1f70ef0ec4f2434f9f072e718140ff8050b81ba3
Merge "Fix Undefined offset notice"