Fix many2many & many2one bugs

Change-Id: Ibaba0f7f011db87a6e425ee83077a30f1ea74c76