cleanup before making a map