I think this issue is related to the timing of Javascript run through.
I get it right through when I open my page with debugger that runs “slow” or “step-by-step” mode.
I was searching the forum if somebody find similar issues and I did find @NigelG was mentioning about it in here.
So, do you think this issue is not related to the Env Variable? @gaurav