Additional changes to support queryset with custom model