modify to check if duplicated variables are used in quantification