minor race condition fixes