Fixed an issue with the threadpool