make public API thread safe