         @setRecursive(keys.concat([key]).join('.'), childValue)
     else
       try
-        value = @scrubValue(keyPath, value)
+        value = @makeValueConformToSchema(keyPath, value)
         defaultValue = _.valueForKeyPath(@defaultSettings, keyPath)
         value = undefined if _.isEqual(defaultValue, value)
         _.setValueForKeyPath(@settings, keyPath, value)

module.exports =
class Config
  EmitterMixin.includeInto(this)
  @schemaValidators = {}

  @addSchemaValidator: (typeName, validatorFunction) ->
    @schemaValidators[typeName] ?= []
    @schemaValidators[typeName].push(validatorFunction)

  @addSchemaValidators: (filters) ->
    for typeName, functions of filters
      for name, validatorFunction of functions
        @addSchemaValidator(typeName, validatorFunction)

  @executeSchemaValidators: (keyPath, value, schema) ->
    error = null
    types = schema.type
    types = [types] unless Array.isArray(types)
    for type in types
      try
        filterFunctions = @schemaValidators[type].concat(@schemaValidators['*'])
        for filter in filterFunctions
          value = filter.call(this, keyPath, value, schema)
        error = null
        break
      catch e

        newValue = []
        for item in value
          try
            newValue.push @executeSchemaEnforcers(keyPath, item, itemSchema)
          catch error
            console.warn "Error setting item in array: #{error.message}"
        newValue
