Fix an index array check.

Patch by Marius Wachtler.