work around scala thread safety issue around typeOf