Make it thread-safe. It can't be used in concurrent function calls.