Fixed map iterator remove failing rarely.

closes #1390