mitigate non-thread-safe race conditions