If current_task_number is meant to be an index, this could set it to zero when zero isn't a valid index.