Fixed some bugs with the resistor.