further small fixes to tasks and threads