Fix bugs in previous queryset support