fixed error printing duplicates