Fixed some bugs in newTCF function