The code I gave in my last reply with hard-coded values for IP addresses, works. Even adding your snippet for "if exists" works.
But when I use it in my original code, which reads values from config file, then it doesn't work. Yes, even the snippet you suggested doesn't work.
I'm really at my wits end here... :(