Fixed bugs with timers and references