fix list index bug