fixed bug in the calculation of t