Use map[key] = value instead of map.insert(std::make_pair(key, value)).

The version with insert does not work and I don't understand why.