fix ttl calculation