fixing index bug from previous commit