Fix component add/change and delete dialogs

Looking over this function, I realised I'm not actually understanding what is happening here. Deleting the second route if there are two seems a bit surprising and unrelated to direction flipping, could you explain?