Fix tests in batch mode