Index out of range fix by gboudreau.