fix bug when sorting on a property which are not present in documents
clean up