ESB bug fixes and integration tests

Two integration tests and two ESB bug fixes