* correctly initialize link->tei and link->sapi
* fix debug printf