thread-safety tweaks

Changes made during 3rd-party thread-safety analysis.