         let stringTotalDistance = NSString(format: "%.1f", totalDistance/1000)
         totalDistanceValueLabel.text = "\(stringTotalDistance) km"
         
-        var averageSpeed = totalDistance/1000/(duration/(100*60*60))
-        if totalDistance == 0 && duration == 0 {
-            averageSpeed = 0
+        
+        if totalDistance == 0.0 && duration == 0.0 {
+            averageSpeed = 0.0
+        } else {
+            averageSpeed = totalDistance/1000/(duration/(100*60*60))
         }
         let stringAverageSpeed = NSString(format: "%.1f", averageSpeed)
         averageSpeedValueLabel.text = "\(stringAverageSpeed) km / h"

        
        totalCount = recordModel.saveRecords.count+1
        totalCountValueLabel.text = "\(totalCount!)"
        
        for data in recordModel.saveRecords {
            totalDistance += data.distance
            duration += data.duration
        }
        
        let stringTotalDistance = NSString(format: "%.1f", totalDistance/1000)
        totalDistanceValueLabel.text = "\(stringTotalDistance) km"
        
        let averageSpeed = totalDistance/1000/(duration/(100*60*60))
        let stringAverageSpeed = NSString(format: "%.1f", averageSpeed)
        averageSpeedValueLabel.text = "\(stringAverageSpeed) km / h"
    }
    
    func didDismiss() {

    var totalCount: Int?
    var totalDistance = 0.0
    var duration = 0.0
    var averageSpeed = 0.0
    
    let recordModel = DataManager.sharedDataManager
    
