Fix the out-of-bound failure in stylesheet iterator.