 		self.mainCoordinator = {
 			let psc = NSPersistentStoreCoordinator(managedObjectModel: mom)
 			connectStores(toCoordinator: psc, andExecute: { [unowned self] in
-				self.setupMainContext()
+				DispatchQueue.main.async { [unowned self] in
+					self.setupMainContext()
+				}
 				self.setupDone(flags: .mainPSC)
 			})
 			return psc

		moc.mergePolicy = (isMainContextReadOnly) ? NSRollbackMergePolicy : NSMergeByPropertyStoreTrumpMergePolicy

		mainContext = moc
	}

	@available(iOS 10.0, *)

	static let base = SetupFlags(rawValue: 1)
	static let mainPSC = SetupFlags(rawValue: 2)
	static let writePSC = SetupFlags(rawValue: 4)
	static let mainMOC = SetupFlags(rawValue: 8)

	static let done : SetupFlags = [.base, .mainPSC, .writePSC, .mainMOC]
}


