fix the race for task init