Fix for #316 - Custom QuerySet and test case.

As per #316, the test case that was failing before, has now been fixed.