Fixed a crash when tasks were deleted.