Some more fixes to writing down and tc generation