Fixed bug in timer