Improved thread safety of internal stateful types