assinging the task index correctly