Bug in distinct method

If distinct is called on ListFired(ReferenceField('ModelName')), it raises 
```TypeError: TopLevelDocumentMetaclass object argument after ** must be a mapping, not ModelName```

Patch fixes this bug by checking the type of the field before casting.