added function SumUpstreamAreas(), bug fixes elsewhere