fix task.length bug