Added needed is defined check to tasks.