Data map fixes

Make sure datamap is restored prior to returning counts or array values extracted from internal values
data() method returns keys and values as array, not just the values with auto incrmenting integer key.