Fix potential NullPointerExceptions when retrieving entities from a sector