changed wrong index bug