Fix the memory problems about map.