add missing thread lock (segfault)