I'm using Stata 14

I'm trying to put the ORs from a regression into successive rows of the variable test1 and test2. I have 1500 observations in my data set. I will eventually want to change the number of iterations from 5 to a large number.
The correct values end up in the test1 and test2 from the matrix log_tbl but they do not end up in the 1st 5 rows of test1 and test2. They do show up on the same row but the rows seems to be randomly selected. If I run the for loop again, the OR end up on different rows.
The disp shows up as 1,2,3,4,5 as expected.

In the second for loop below, the values in the 1st 5 rows are 1 to 5 just as I'd expect.
And if I enter replace test1 = log_tbl[1,1] in 1 on the command line, it shows up in the first line.

Is this a known bug, am I missing something obvious?
Thanks

Code:
gen test1 = .
gen test2 = .

forval w = 1/5 {    
    bsample 100 if strats == 2 & sex == 0, strata(strats) weight(Qwts)
    quiet replace Qwts = 1 if strats == 0 
    quiet logit outcome i.exposure c.age28 c.age29 i.urban_rural ///
        if sex == 0 & (Q_posneg == 0 | Q_posneg == .) ///
        [pweight=Qwts], iterate(50) vce(robust) or 
    matrix logist_tbl = r(table)' 
    * grabs 2nd and 3rd OR, won't need 3rd row for diab. 
    matselrc logist_tbl log_tbl, r(2,3) c(1)  
    quiet replace test1 = log_tbl[1,1] in `w'
    quiet replace test2 = log_tbl[2,1] in `w'    
    disp `w'    
}

forval w = 1/5 {    
    replace test1 = `w' in `w'
    replace test2 = `w' in `w'
}