Support one-to-one relationships.

The one-to-one relationship does not work. I have added some tests to reconstruct the problem.