bucketize has a bug related to greedy iterator takeWhile; buffered iterator and some other loop construct should help