Correctly set type and serialize correct value for References

Conflicts:
	CHANGELOG.md
Well updating the type is not supported currently (I am not sure I remember why). But it is strange that updating a property *value* should change its type? I would have thought that if a property already has a type assigned then it would keep that type and cast any subsequent value to that type.