fix 'boxed iterator can't be used in for loop' problem.

Had to hack around this for now with an iterator adaptor