some changes to threadpool code