Fix inherited queries (issue #106)

The commit 8e350cc broke support for
inherited queries. This fixes the issue.

Note that a query result will be cast to whichever registered type
its type_field indicates, not just those which are subtypes
of the cursor's collection.

Credit to effem-git@GitHub for the code.