revise the order of generating tdt