Add guard clauses in map functions that use sum(values)