Fixed ttl code that was broken in custom branch