Fixed bugs in WorkerManagerImpl and in tests