Ok - great. Yeh - I see your problem.... NOT
How do you expect anyone to make this work? You have supplied 2 random lines from your code with no idea of where scope starts, ends, what happens after the if statements etc.
I don't want all the details of your code (i'd probably just laugh myself to death if I read it), but a bit more information would be soooo helpful.
Please let me remind you - there are a lot of geniuses on this board, but none of us can help when you don't give us information. If you want some serious help - then show us some more of the construct.