TOOLS-494: fix index counting issue in restorewithauth.js