fix timer code