Fix many of the integration tests.

There are only two more that fail and these will be fixed in a
subsequent PR.