Sounds like intermittent wiring connector problems.
With the machine in switch test, gently push and pull on the connectors to the trough opto boards and see if you can get the optos to open.
Rebuild the connector. Great Plains Electronics has all you need.