add code to compute s.f. wrt to e->g