The problem you are experiencing migth be common mode noise present on the batteries. The optocouplers have a bit of capacitance from input to output, which will couple the noise from the switcher through the circuit. I would do what sensacell suggests, especially the schmitt trigger and lower value pullup. Also some HF filtering on the inputs might help. And I would change all the ICs before you try again.