fix initial_term_index, plus test
updated changes