Fixing the task index issue