restore main for batchservice