Fix bug with managers in worker thread and format TaskPool.hpp