Do you need `tmp`?  Its a sketchy method and shouldn't be built on.  Just use a local static and "set" if you are using it now.