fix a serious bug in batch.run