Fixes an exception when a has_one association is recursively restored.