added return function after a task quits