First integration test, and fixes to go with it