Bairstow hits ton, Stokes defies pain as England fight back