Fix sel_next_hop() according to Hiroki's code