Change primitive type dict format; fixes for m2m; useful fix_pony_mode function