Some code fixes for timers