You've misunderstood how to put together a for-each loop - you don't need the other loop at all, for-each works on its own! In the .cap you provided, all you need to do is:
+ For Each Box
and that does all the repeating and picking for you automatically, it's really very simple. Still, it shouldn't crash no matter what combination of conditions you come up with, so I'll try fixing that for next build.