It will be the speed sensor thats causing your speedo to work intermittently, they always fail, very common.
The engine cutting out when pulling up to a stop is probably the idle control valve, you can try cleaning it out but if it were me I'd just bang a new one on.
And the focus doesn't have this T-piece either.