add test and fix for threaded config leak