For motors: Each winding needs four diodes, two at each output (8 diodes for one motor total). At each pin, one diode to ground (cathode to motor, anode to ground) and one to +12-36V (anode to motor, cathode to power bus). Diodes to ground are on the board already (at least my board has them). Just connect each of the motor outputs to the power rail with a diode (cathode to power rail), now it's Ok.
For the relay: just one diode between the relay winding pins, also connected backwards.