Fixed bug where wrong relation gets overwritten during a patch method.