re-implement tpt.setdebug