Fix on the routing algorithm of tasks