Fix fatal errors from  altering.
Merge pull request #6488 from openscholar/6487

Fix fatal errors from  altering $map