Fixed validation when trying to set an object instead of a value.