better lock and ttl handling