adds some integration tests and fixes