Fix array indexing