fix rule disappearance bug due to deletion under iteration

Signed-off-by: Andrey Rybalchenko <rybal@microsoft.com>