                   }
                }
                
-               if photoKeys.count == results.count {
+               if numLoaded == results.count {
                   // we've saved all the results to our photo library
                   // and can safely make our observation and move on
                   

                     if let date = takenDateForObs {
                        o.timeObserved = date
                     }

                     for i in 0..<photoKeys.count {
                        let op = ExploreObservationPhotoRealm()
                        op.uuid = UUID().uuidString.lowercased()
                        op.timeCreated = Date()
                        op.timeUpdatedLocally = Date()
                        op.position = i
                        op.photoKey = photoKeys[i]
                        
                        o.observationPhotos.add(op)
                     }

         // user cancelled
         return
      }
      
      // for sorting since the fetch can come back out of order
      var resultsToPhotoKeys = [PHPickerResult: String]()
      for result in results {
         resultsToPhotoKeys[result] = ImageStore.shared().createKey()
      }
      var numLoaded = 0
      
      var takenDateForObs: Date? = nil
      var takenLatitudeForObs: Double? = nil
