Fix/ttl overflow

Fixes also #2303