in reply to Re^2: problem with variables
in thread problem with variables

Well, it seems that in the meanwhile you have solved your problem. My point was about preparing a suitable complete but minimal example still exhibiting the problem. This is a general recommendation as to how to ask for help, and sometimes it's hard or even impossible to do, but that's rare. More commonly it even happens that while doing so one will find the answer to his own question.

Now, as side notes to comment you code: