changes to compareTDI, bugfixes