Fix coverity warnings

replacing the assigments in the logical conditions by an (unordered)
map.
For the future, it is probably worth to extract rootmap reading in
a separate helper class.