fix a bug related to branch_list index out of range