fix linking of TH dependencies