add support for thread local variables