Fixed incorrect call to array index