Fixes

These patches are trying to be upstreamed, but hampered by autotests in service framework failing on mac.