Fixing wrong index