Threading bug fix.