fix related_name template substitution