changed access to x[i]