#vulnerable code 
                                void dfs(int k, int node, float score,
             PriorityQueue<Pair> heap,
             Vector hidden) {
        if (heap.size() == k && score < heap.peek().first) {
            return;
        }

        if (tree[node].left == -1 && tree[node].right == -1) {
            heap.add(new Pair(score, node));
            if (heap.size() > k) {
                heap.remove();
            }
            return;
        }

        float f = sigmoid(wo_.dotRow(hidden, node - osz_));
        dfs(k, tree[node].left, score + log(1.0f - f), heap, hidden);
        dfs(k, tree[node].right, score + log(f), heap, hidden);
    } 
                            #location 16 
                            #vulnerability type THREAD_SAFETY_VIOLATION
#fixed code
                                Model(Matrix wi,
          Matrix wo,
          Args args,
          int seed) {
        hidden_ = new Vector(args.dim);
        output_ = new Vector(wo.m_);
        grad_ = new Vector(args.dim);
        random = new Random(seed);
        wi_ = wi;
        wo_ = wo;
        args_ = args;
        isz_ = wi.m_;
        osz_ = wo.m_;
        hsz_ = args.dim;
        negpos = 0;
        loss_ = 0.0f;
        nexamples_ = 1;
    }