Minor improvements on relationship validation.

Fixed a bug when change a relationship from being identifier and passing
to use a special pk.