fixed index bug for real this time(?)