fix index bug