Bug fix in random entity getter