Indexing array wrong