Fix PR2596: out of bound reference.