fix a bug ditributing tasks