Change call to map::erase to work on GCC 4.4

Closes #2064
Review 1293 by @mlucy