WAN Failover help

Hello forum,

We are trying to install a mikrotik router in a company with two IPS’s

Port 1 IPS1
Port 2 ISP2 (Backup)

within the router
two masqureade rules
two routes
connectivity script

This script is Pinging port 1 (ISP 1) to check if there is conectivity. Ifnot it changes the distance of port 1 so all traffic will go to port 2 (IPS 2) And if the connectivity is back on port 1 it changes the distance back so all traffic will go by port 1 (ISP 1)

This script works well. But.

the two routes will automaticly mark the port with the highest distance inactive.
So when the script want to check port 1 (ISP 1) again for connectivity but it cant because the route of port 1 is disabled.

How can do this.

or another idea.

Rob