deal with empty dict
update idx