Replace std::map::at with check if an element exists + at.

Previously it was done via operator[] (yes, indeed),
but this creates an entry and is no longer
possible (map is immutable).