Fix a bug in unique_with queryset generation