avoided multiple calls of timer.cancel()