Fixed an issue with one to many relations

As described in #2325
Merge pull request #2358 from net02/patch-3

Fixed an issue with one to many relations