Fixed a callback referencing issue with tasks and threads.