threadpool cleanup fixes