Problem with "name rewrites script"

Hi
I hawe a problem with the script:

 :foreach ip in=[/ip firewall address-list find list=("USERS_ON_LAN")] do={/i
p firewall address-list  set [find list=("USERS_ON_LAN") address=[/ip firewall address-list g
et $ip address]] comment=[/queue simple get [find target-addresses=[/ip firewall address-list
 get $ip address]] name ]}

The script is to move the names of the queues in the addresslist comment. I used it in version 2.9 and work there without a problem I have now 3.20 and I can not run it. Where do I make an error.

I think the problem is that you have to set the variables you intend to use at the top of your script before using them?

# Set local variables
:local ip

yes that should be the case, you have to initiate it first, even if you intend to use global variable and then you can access its value.