This is wrong, not much point having debug AFTER the return ;)

Also error messages need not be trace, make it tvhlog(LOG_ERR)