added fail safe on electromagnet to make sure it is off at power on