fixed the bug of end task run more than onece