small threading changes