TLS: Fix dangling str() pointers
TLS: Minor code cleanups