Add missing thread-locking