fix a bug about M2M insert