Fixing bug when selecting neighbors in an empty queryset of related elements