Fix for bug caught by unit tests...createInstance calls createUnmanagedinstance which always activates the unmanaged instance flag true.