Fix managed service factory

Multiple changes to fix the managed service factory in blueprint.

There are multiple issues reported about this. For example: https://issues.apache.org/jira/browse/ARIES-915.