Fix indexing wrong var