check the brown and brown/white wires to the side of the head. one of them is the earth for the clocks, other is earth for the engine management. if bad connection here this could explain both issues

or it might be a problem with the battery cabling, if the mfa gets low voltage it goes spazzer, this could again also explain why engine is cutting out.
last of all make sure idle switch is clicking when throttle is closed, and wiring to the throttle switches hasnt snapped behind the inlet. then go around doing the obvious checks for vac leaks etc.