If the optos are intermittent, that implies they are working fine from a component standpoint. This usually is a result of cracked solder joints for the opto, or on sterns/segas with the narrow beam of light, misalignment.
First, get a white piece of paper and hold it over the receiver side (you can tell as one side is the one obviously shining a light). Hold this over the other opto that receives the light, and you can see if the bean lines up with the opto on the other side. If not, adjust.
If this is not the issue, then I would be removing both opto boards and reflowing the opto solder pads and the connections to the boards.