Thread-safe fixes