refactor detail::Map for memory efficiency
fix a memory leak
add String::replace