Fix array indexing through variables