another attempt to fix endless loop in ThreadPool