fix invalid array index references in unit test