Array indexing fix