fix TA's ugly code