fix bug in thread pool