Fixed threadlocals middleware path in settings