         PlaceSearch().fetchPlaces(with: categories, location: currentCoordinates, success: { (places: [Place]?) in
             if let places = places {
                 self.placeArray = places
-                let end = min(self.placeArray!.count, self.numResults)
+                let end = min(places.count, self.numResults)
                 self.addPlaces(places: Array(places[..<end]))
             }
         }) { (error: Error) in

                
                // Add an AR node and map view annotation for every defined "step" in the route
                for step in leg.steps {
                    let coordinate = step.coordinates!.first!
                    polyline.append(coordinate)
                    let stepLocation = CLLocation(latitude: coordinate.latitude, longitude: coordinate.longitude)
                    
                    // Update feature collection for map view
                    self.updateShapeCollectionFeature(&self.waypointShapeCollectionFeature, with: stepLocation, typeKey: "waypoint-type", typeAttribute: "big")
                    
                    // Add an AR node
                    let annotation = Annotation(location: stepLocation, calloutImage: self.calloutImage(for: step.description), place: nil)
                    annotationsToAdd.append(annotation)
                }
                
                let metersPerNode: CLLocationDistance = 5

        
        // Initiate the query
        let _ = directions.calculate(options) { (waypoints, routes, error) in
            if let error = error {
                print("Error calculating directions: \(error.localizedDescription)")
                return
            }
            
