fixed issues with crashing when a task dies