Fixed remove_index bug