added UB in topsort.c