Fix permission issue on m2m

Fixes RM-2803