Improved thread safety of internals.