small fix to threading