fixed confusing glitch with array indexing