[bucket] Remove recursion in inventory code

Not only using a recursion there was slow and it made the code unreadable,
the implementation was simply wrong: there was a chance bucket would return
banans even if there are available items still.

Also, fix a typo