Fix running SF with multiple threads