task executor was incorrectly accessing the tasks array