Reactivated thread local + minor fixes