fixed t_i key gen, checked with solution: works!