added error hceckign switch and fixed Regulator.zero()