Fix mem corruption in TUBTF code