Several fixes to TL until it appears to give reasonable results.

Also an incidental bugfix to the commit phase.