Fix bug in the dynamic task