thread-safe fix