monkey patch thread safety issue