Workaround minres bug. Threadprivate pointers very poorly dealt with.