handle empty list in wait_for_tasks