added DISTINCT to generic.py