reset the index for before stack