             self.basal = basalRaw.compactMap { ScheduleItem(rawValue: $0) }
             self.targetLow = targetLowRaw.compactMap { ScheduleItem(rawValue: $0) }
             self.targetHigh = targetHighRaw.compactMap { ScheduleItem(rawValue: $0) }
-            self.units = nil
+            self.units = rawValue["units"] as? String
          }
     }
     

        }

        public var dictionaryRepresentation: [String: Any] {
            return [
                "dia": dia.hours,
                "carbs_hr": "0",
                "delay": "0",

                "basal": basal.map { $0.dictionaryRepresentation },
                "carbratio": carbratio.map { $0.dictionaryRepresentation },
                ]
            rval["units"] = units
            return rval
        }

        init?(rawValue: RawValue) {
