copy codes for map_util