fixed crash problem at end of timer