fixed query to retrieve connections