add sanity check functions
diff --git a/planetstack/hpc_observer/steps/sync_serviceprovider.py b/planetstack/hpc_observer/steps/sync_serviceprovider.py
index 36f2689..19c6db3 100644
--- a/planetstack/hpc_observer/steps/sync_serviceprovider.py
+++ b/planetstack/hpc_observer/steps/sync_serviceprovider.py
@@ -24,6 +24,20 @@
         SyncStep.__init__(self, **args)
         HpcLibrary.__init__(self)
 
+    def fetch_pending(self, deleted):
+        self.sanity_check()
+
+        return SyncStep.fetch_pending(self, deleted)
+
+    def sanity_check(self):
+        # sanity check to make sure our PS objects have CMI objects behind them
+        all_sp_ids = [x["service_provider_id"] for x in self.client.onev.ListAll("ServiceProvider")]
+        for sp in ServiceProvider.objects.all():
+            if (sp.service_provider_id is not None) and (sp.service_provider_id not in all_sp_ids):
+                logger.info("Service provider %s was not found on CMI" % sp.service_provider_id)
+                sp.service_provider_id=None
+                sp.save()
+
     def sync_record(self, sp):
         logger.info("sync'ing service provider %s" % str(sp))
         account_name = self.make_account_name(sp.name)