fix find_affected_records_for_index