Fix variable naming issue in _load_tasks()

Fixes #6800