Integration tests and fixes