fix categorize iterator overflow