Fix loop limit that caused out of bounds error on vector access.

Refs #7672