fix bug in timer