Fix bug: directly call map[x] has a side effect: if the key does not exist, the map would automatically generate a key