Index: trunk/FACT++/src/biasctrl.cc
===================================================================
--- trunk/FACT++/src/biasctrl.cc	(revision 17639)
+++ trunk/FACT++/src/biasctrl.cc	(revision 17640)
@@ -1605,5 +1605,4 @@
 
     bool fExpertMode;
-    bool fEmergencyShutdown;
 
     Time fSunRise;
@@ -1867,13 +1866,11 @@
     {
         fBias.RampAllDacs(0);
-        fEmergencyShutdown = true;
-        T::Info("Emergency Sutdown initiated.");
-        return T::GetCurrentState();
+        T::Info("Emergency shutdown initiated.");
+        return State::kLocked;
     }
 
     int Unlock()
     {
-        fEmergencyShutdown = false;
-        return T::GetCurrentState();
+        return fBias.GetStatus();
     }
 
@@ -1885,24 +1882,22 @@
         if (now>fSunRise)
         {
-            if (state==State::kRamping       ||
-                state==State::kVoltageOn     ||
-                state==State::kNotReferenced)
-                return Shutdown();
-
-            if (state==State::kLocked)
+            if ((state==State::kRamping       ||
+                 state==State::kVoltageOn     ||
+                 state==State::kNotReferenced ||
+                 state==State::kOverCurrent))
             {
-                fSunRise = now.GetNextSunRise(-6);
-
-                ostringstream msg;
-                msg << "Next sun-rise will be at " << fSunRise;
-                T::Info(msg);
-
-                return T::GetCurrentState();
+                T::Error("Voltage on at end of nautical twilight!");
+                Shutdown();
             }
-        }
-
-        if (T::GetCurrentState()==State::kVoltageOff && T::GetCurrentState()==State::kLocked)
+
+            fSunRise = now.GetNextSunRise(-6);
+
+            ostringstream msg;
+            msg << "During next sun-rise nautical twilight will end at " << fSunRise;
+            T::Info(msg);
+
             return State::kLocked;
- 
+        }
+
         if (fExpertMode && state>=State::kConnected)
             return State::kExpertMode;
