Why are you registering an already registered IP?
I don't think you were thinking when you said this.
The script is meant for dynamic connections. Obviously, someone else who previously was assigned that dynamic IP is also a tunnel holder and used it to establish his/her tunnel in an earlier session. Of course, they're disconnected now, but such blocks any other tunnel from being established.
Perhaps HE should request the (initial) static vs. dynamic status of any IPv4 address a tunnel is being connected to. When someone tries to (re-)assign a dynamic address, then HE should ping that tunnel, and if such pings fail, then reassign. Static assignments would be protected from that procedure. The former holder of that dynamic IPv4 endpoint would get 0.0.0.0 assigned to that field, thus deactivating that tunnel.