fix a function template bug, change the thread interface