fixing some race conditions on tasks
trying to fix some race conditions II