fixed diode bugs