Fix context setting for batch runs.