Fix foreach in pollRunning method - we should fetch task on each iteration because this array could be changed in between