Index: display_tix.h
===================================================================
--- display_tix.h	(revision 302)
+++ display_tix.h	(working copy)
@@ -86,7 +86,7 @@
 #define _DISP_TOGGLE_TOGGLE_RANDOM_CODE                  \
               ++g_displayParams->mode;                   \
               g_displayParams->mode %= TM_COUNT;         \
-              addSubState( g_topOfStack-1, MS_showNumber, (void*)(g_displayParams->mode+1));\
+              addState( MS_showNumber, (void*)(g_displayParams->mode+1));\
               log_state("tix\n");
 
 // declare the ir-handler for the Key
Index: display_wc_ger.h
===================================================================
--- display_wc_ger.h	(revision 302)
+++ display_wc_ger.h	(working copy)
@@ -150,7 +150,7 @@
 // code to execute on keypress
 #define _DISP_TOGGLE_OSSI_CODE \
               g_displayParams->ossiMode = !g_displayParams->ossiMode; \
-              addSubState( g_topOfStack-1, MS_showNumber, (void*)(g_displayParams->ossiMode?2:1));\
+              addState( MS_showNumber, (void*)(g_displayParams->ossiMode?2:1));\
               log_state("WO\n");
 
 // declare the ir-handler for the Key
Index: display_wc_ger3.c
===================================================================
--- display_wc_ger3.c	(revision 302)
+++ display_wc_ger3.c	(working copy)
@@ -151,7 +151,7 @@
   leds |= display_getNumberDispalyState(hour);
 
   if(   (hour==1 || hour==13 )   // if "Es ist ein Uhr" <- remove 's' from "eins"
-     && (minutes==1))
+     && (minutes==0))
   { 
     leds &= ~(1L << DWP_s); 
   }
Index: display_wc_ger3.h
===================================================================
--- display_wc_ger3.h	(revision 302)
+++ display_wc_ger3.h	(working copy)
@@ -166,7 +166,7 @@
 #define _DISP_TOGGLE_DISPMODE_CODE \
               ++g_displayParams->mode;                   \
               g_displayParams->mode %= TM_COUNT;         \
-              addSubState( g_topOfStack-1, MS_showNumber, (void*)(g_displayParams->mode+1));\
+              addState( MS_showNumber, (void*)(g_displayParams->mode+1));\
               log_state("WRO\n");
 
 // declare the ir-handler for the Key
Index: user.c
===================================================================
--- user.c	(revision 302)
+++ user.c	(working copy)
@@ -86,7 +86,7 @@
  *  @param  mode        the state to add
  *  @param param  parameter for the sub state
  */
-static void    addSubState( e_MenuStates curState, e_MenuStates mode, const void* param);
+static void    addSubState( int8_t curState, e_MenuStates mode, const void* param);
 
 /**
  *  a state quits it self
@@ -134,7 +134,34 @@
 static uint8_t curTimeIsBetween ( uint8_t h1, uint8_t m1, uint8_t h2, uint8_t m2);
 
 
+#if (USER_LOG_STATE == 1) 
+static void printStateStack(){
+  uint8_t i=0;
+  uart_puts_P("stack: [");
+  for(;i<g_topOfStack;++i)
+  {
+    uart_putc(g_stateStack[i] + '0');
+    uart_putc(' ');
+  }
 
+  for(;i<USER_MAX_STATE_DEPTH;++i)
+  {
+    uart_putc('_');
+    uart_putc(' ');
+  }
+  uart_putc(']');
+  uart_putc('\n');
+
+}
+
+#define PRINT_STATE_STACK() do{printStateStack();}while(0)
+#else
+#define PRINT_STATE_STACK() 
+#endif
+
+
+
+
 #if (USER_LOG_STATE == 1)
 #  define   log_state(x)  uart_puts_P(x)
 #else
@@ -161,7 +188,7 @@
 
 // just include file here to give compiler more possibilities for optimizing 
 /// @todo consider making normal interface and using whole program optimization
-#include "userModes.c"
+#include "usermodes.c"
 
 
 static void addState(e_MenuStates mode, const void* param)
@@ -172,16 +199,24 @@
     g_currentIdxs[mode] = g_topOfStack;
     ++g_topOfStack;
     UserState_enter(mode, param);
+
+    PRINT_STATE_STACK();
 }
 
-static void addSubState(e_MenuStates curState, e_MenuStates mode, const void* param)
+static void addSubState(int8_t curState, e_MenuStates mode, const void* param)
 {
   uint8_t success = TRUE;
-  int8_t currentIdx = g_currentIdxs[curState];
+  int8_t nextIdx;
+  if( curState == -1 ){
+    nextIdx = 0;
+    log_state("replace Base state\n");
+  }else{
+    nextIdx = g_currentIdxs[curState] +1;
+  }
   log_state( "addSubstate\n");
-  if( currentIdx+1 != g_topOfStack)  // first remove all pending sub states
+  if( nextIdx != g_topOfStack)  // first remove all pending sub states
   {
-    success = leaveSubState( currentIdx + 1);
+    success = leaveSubState( nextIdx );
   }
 
   if( success ){
@@ -211,6 +246,7 @@
         uart_puts_P(", ");
       }
 #     endif
+
   }
 
   if( success ){
@@ -218,6 +254,7 @@
     {
       UserState_LeaveState(g_stateStack[i]);
       --g_topOfStack;
+      PRINT_STATE_STACK();
     }
   }
 
@@ -295,7 +332,7 @@
             handled  =    handled || UserState_HanbdleIr(g_stateStack[i], ir_code);
           }
 
-          if( i <0 )                                     // command was not handled by subState
+          if( !handled )                                     // command was not handled by subState
           {   
             if( UI_BRIGHTNESS_UP == ir_code ){
                 log_state("B+\n");
@@ -372,20 +409,8 @@
 
 void user_init(void)
 {
-  TrainIrState_init();
-  ShowNumberState_init();
-  NormalState_init();
-  DemoState_init();
-  SetSystemTimeState_init();
-  SetOnOffTimeState_init();
-  EnterTimeState_init();
-  PulseState_init();
+  UserState_init();
 
-# if (MONO_COLOR_CLOCK != 1)
-  AutoHueState_init();
-# endif // (MONO_COLOR_CLOCK != 1)
-
-
   addState(MS_normalMode, (void*)1);
   addState(MS_irTrain,    NULL);
 
Index: user.h
===================================================================
--- user.h	(revision 302)
+++ user.h	(working copy)
@@ -123,10 +123,10 @@
 #define UI_COLOR_PRESET_COUNT 4
 
 #define USER_COLORPRESETS_DEFAULTS {\
-   { 0xff,    0,    0 } /* red   */, \
-   {    0, 0xff,    0 } /* green */, \
-   {    0,    0, 0xff } /* blue  */, \
-   { 0xff, 0xff, 0xff } /* white */, \
+   { MAX_PWM_STEPS-1,               0,               0 } /* red   */, \
+   {               0, MAX_PWM_STEPS-1,               0 } /* green */, \
+   {               0,               0, MAX_PWM_STEPS-1 } /* blue  */, \
+   { MAX_PWM_STEPS-1, MAX_PWM_STEPS-1, MAX_PWM_STEPS-1 } /* white */, \
 }
 
 #define USER_ADDRESS_DEFAULT 0x7B80
Index: usermodes.c
===================================================================
--- usermodes.c	(revision 302)
+++ usermodes.c	(working copy)
@@ -106,6 +106,9 @@
 /*********************************************************************************/
 /*********************************************************************************/
 
+/** initializes all states  */
+static void UserState_init();
+
 /** Dispatcher routine to determine if the given state can be left now  */
 static uint8_t UserState_prohibitLeave( e_MenuStates state );
 
@@ -206,6 +209,7 @@
       log_irTrain("invalid ir-address\n");
     }else{
       g_params->irCommandCodes[mode_trainIrState.curKey-1] = i_irCode->command;
+      ++mode_trainIrState.curKey;
       if( mode_trainIrState.curKey == UI_COMMAND_COUNT ){ /* finished */
         log_irTrain("Ir train finished\n");
         wcEeprom_writeback( g_params, sizeof(*g_params) ); /* save all */
@@ -216,6 +220,7 @@
   }else{
     mode_trainIrState.seconds = UINT8_MAX;
     g_params->irAddress = i_irCode->address;
+    ++mode_trainIrState.curKey;
   }
 
 # if USER_LOG_IR_TRAIN
@@ -228,7 +233,6 @@
   }
 # endif
 
-  ++mode_trainIrState.curKey;
   disp = display_getNumberDispalyState(mode_trainIrState.curKey) | display_getIndicatorMask();
   display_setDisplayState( disp, disp );
 
@@ -454,6 +458,7 @@
       log_time("TS\n");
       mode_enterTimeState.time.ss = 0;
       mode_enterTimeState.prohibitLeave = FALSE;
+      pwm_release_brightness();
       quitMyself(MS_enterTime, &(mode_enterTimeState.time));
       return TRUE;
     }
@@ -640,8 +645,23 @@
 /*********************************************************************************/
 /*********************************************************************************/
 
+static void UserState_init()
+{
+  TrainIrState_init();
+  ShowNumberState_init();
+  NormalState_init();
+  DemoState_init();
+  SetSystemTimeState_init();
+  SetOnOffTimeState_init();
+  EnterTimeState_init();
+  PulseState_init();
 
+# if (MONO_COLOR_CLOCK != 1)
+  AutoHueState_init();
+# endif // (MONO_COLOR_CLOCK != 1)
 
+}
+
 static void UserState_enter( e_MenuStates state,  const void* param )
 {
   if( MS_enterTime == state ){
