All tests passing again

This should get all the tests passing agin. It also touches on a few other issues which I'll comment on separately.