Fix bug with service_ensure, add test coverage