Correctly set type and serialize correct value for References

Conflicts:
	CHANGELOG.md
i guess that depends on the php type of the value, no? if its an array, on the type of the first array element.