Fixes to ensure that has_one associations work correctly
Merge conflict resolution in master