fixes to retrieving entities