calculate t-invariants
fixing some issiues