fix relation between templates