Fix a pair of array index checks.

Patch by Marius Wachtler.