dhcp client script acting weird !!

Hi,
I used the Lease script example in the wiki
and it’s working fine, when i click enable on the dhcp-client i see that the route is added and also see in the log “route added”, when i click disable i see the route is removed and the log says “route removed”
so far so good.
now if i add one line of code to the start of the script

:local network  [/ip address get [find address="172.16.1.188/24"] network]

then everything breaks no routes are added or removed and nothing in the log either.

just to be clear this is the final command

add add-default-route=no disabled=no interface=ether1 script="{\r\
    \n    :local network  [/ip address get [find address=\"172.16.1.188/24\"] network]\r\
    \n    :local rmark \"WAN1\"\r\
    \n    :local count [/ip route print count-only where comment=\"WAN1\"]\r\
    \n    :if (\$bound=1) do={\r\
    \n        :if (\$count = 0) do={\r\
    \n            /ip route add gateway=\$\"gateway-address\" comment=\"WAN1\" routing-mark=\$rmark\r\
    \n        } else={\r\
    \n            :if (\$count = 1) do={\r\
    \n                :local test [/ip route find where comment=\"WAN1\"]\r\
    \n                :if ([/ip route get \$test gateway] != \$\"gateway-address\") do={\r\
    \n                    /ip route set \$test gateway=\$\"gateway-address\"\r\
    \n                }\r\
    \n            } else={\r\
    \n                :error \"Multiple routes found\"\r\
    \n            }\r\
    \n        }\r\
    \n    } else={\r\
    \n        /ip route remove [find comment=\"WAN1\"]\r\:local network  [/ip address get [find address="172.16.1.188/24"] network]
    \n    }\r\
    \n}\r\
    \n"

what am i doing wrong?