fix crash bug: referencing deleted map iterator