Each half of an L298 has a max allowed continuous current rating of 2A. If your motors have an operating current of 3A then it might be 30A when they are started or when they are stalled.
You forgot to attach your schematic so we can't see why your optos don't work. What is the PWM frequency?