Fix undefined totalWeight value crash.

Happens after the map is loaded.