BZ-8765: Fix issue with companies query