Fix for thread local storage changes