fix timer logic and tests