fix wait_index