fix modification of Map during iteration