You also have to be mindful of the REVERSE voltage on the opto's LED input - the 4n25, like many optocouplers, has ABSOLUTE MAX reverse voltage of 5V. These devices will tolerate a volt or two of reverse voltage but I hae found that getting near or above their MAX ratings they will begin to fail, sometimes rapidly, sometimes intermittently. So, your design must ensure that if the opto's input cathode is at system ground, that the anode doesn't drop below ground ground by more than a diode drop or so (preferably 0V).