add function to kill dead tasks