fix for many-to-many recursive save

patch and test for #549