fix memory management issues with new map instances