some fixes to TaskManager