fixed an index bug