change m2m gids to graphics