trollius debug mode and threadsafe fixes