Lots of little fixes from integration testing