Added fix to hasOne relationship

I have made a fix and a couple of simplifications to the way ModelCore handles relationships. Hope this helps!