 			# Handle dereferencing
 			references = @constructor._references
 			if references?
+				that = this
 				dereferencedProperties = @_properties.withMutations (map) -> 
 					for key of references
-						map.set key, @dereference(key)
+						map.set key, that.dereference(key)
 				val = @cache 'dereffed_props', dereferencedProperties
 			else
 				# No references defined, just return the props.

	validateReferenceOnSet: (type, key, value) ->
		switch type
			when 'entity'
				invariant _.isString(values[key]) or _.isNumber(values[key]), """
					#{@constructor.name}.set(...): #{key} must be an id for an entity on #{references[key].store.constructor.name}.
					Ie. either a string or a number.
				"""
				return value
			when 'list'
				# One should never set a value for a list reference, warn.
				console.warn """
					#{@constructor.name}.set(...): #{key} is a reference to the list store #{references[key].store.constructor.name}.
					You can't set a value for a reference to a list store. Defaulting to null.
				"""
				return null

			references = @constructor._references
			for key of keys 
				if key in _.keys(references)
					values[key] = @validateReferenceOnSet references[key].type, key, keys[key]
				else
					values[key] = keys[key]

